Razor/LINQ to compare date picker with time value with current dateTime.Now
Hi All,
I am struggling to filter events by 'end date' and wondering if anyone can please help?
I have a parent node called events (doc type eventPage) and from events you can create child pages( of doctype type event). On the event doc type i have defined a date picker with time like so
On the event page i only want to display a list events that have an end date which hasnt passed the current date and time. I step up to the parent get a list of child nodes and need to compare the end date with the current date
Razor/LINQ to compare date picker with time value with current dateTime.Now
Hi All,
I am struggling to filter events by 'end date' and wondering if anyone can please help?
I have a parent node called events (doc type eventPage) and from events you can create child pages( of doctype type event). On the event doc type i have defined a date picker with time like so
On the event page i only want to display a list events that have an end date which hasnt passed the current date and time. I step up to the parent get a list of child nodes and need to compare the end date with the current date
Attepting suggestions made in this post https://our.umbraco.org/forum/developers/razor/26022-Razor-Where-DatetTime-Greater-Than-Or-Equal-DateX- so far i havent been able to achieve this filter.
Has anyone cracked this or can see where i am going wrong?
Thanks Paul
Would something like this work?
Hi Dan,
Ive been at this hours and youve just solved it for me :). Looks so easy when the code is in front of me but been pulling my hair our.
I made one slight amend on the check (<=). It looks like this
Cant thank you enough mate
Paul
Hey, glad to have helped Paul! Though as you see, I always get the less-than more-than operators mixed up when dealing with dates :)
Hi Dan,
No problems as long as its sorted is the main thing and without your help id be still struggling :)
Paul
is working on a reply...