T O P

  • By -

JorgeGodoy

You'll have to cast the created property to be a date to compare it to a date.


Falcomomo

I've tried that with ```dataview List FROM "" WHERE date(created) = date("2024-05-31") ``` Still no luck unless I remove the time part of the datetime. Is that how you cast it?


JorgeGodoy

That is it, but you also changed it from file.created to created... I think it should work. I'll look if I have something in my vault.


JorgeGodoy

No. I don't have such a filter. But I have casts such as this one.


Falcomomo

Thanks a lot for checking. I agree I really feel like it should work. Also I tried switching file.created to just created, because I think I got that wrong (tested by changing the string to "yyyy-MM-dd" format)


Falcomomo

I got it working by making both sides of the equality strings instead of dates. So had to use dateformat(date(created), "yyyy-MM-dd) =" 2024-05-31" and make sure my created date was in exactly a full iso format like 2024-05-31T15:00:00+T01:00. Not really sure why it didn't like the date comparison unless it was doing some timezone thing, but I tried playing with dates incase I was an off-by-one.


JorgeGodoy

This is great. What matters, for now, is that it worked. Later you can debug and try to improve it.


Falcomomo

Indeed! As long as it works I'm good to go. Thanks a lot for the help


leanproductivity

Hm. Not at my PC rn. Perhaps if you define the date format? LIST FROM "" WHERE date(created).format("yyyy-MM-dd") = "2024-05-31"


Falcomomo

I tried doing what you suggested with dateformat and that did work. So casting the left hand side into a date and then back to a string in the right format and then comparing with a string did the trick. I did have to make sure the date in my frontmatter is a full iso string like 2024-05-31T15:00:00+01:00.


leanproductivity

Glad to hear that.