Open Eplicony opened 1 year ago
This is a long-standing issue due to luxon date formats. As a workaround, you can convert to unix-time and divide.
Try: (( number(dateformat(date(today), "X")) - number(dateformat(date(file.cday), "X")) ) / 86400 ) AS "Diff Day"
As a workaround, you can convert to unix-time and divide. Try:
(( number(dateformat(date(today), "X")) - number(dateformat(date(file.cday), "X")) ) / 86400 ) AS "Diff Day"
I encountered this bug today and kept looking for ways to convert dates to something that would math properly and found your fix. Thanks for the workaround @GovSat1 .
A note that if the dates cross daylight savings you'll end up with fractions so adding a round(,0) is the easy fix:
round((( number(dateformat(date(today), "X")) - number(dateformat(date(file.cday), "X")) ) / 86400 ),0) AS "Diff Day"
What happened?
Here we can see the date(today) is 6 22, the date of file "2023-5-24" is 5 24, but the day time interval between them is 31, making the table not an strictly increasing order.
I think there might be some errors in date calculation method or maybe some details I ignored.
DQL
JS
No response
Dataview Version
0.5.56
Obsidian Version
v1.3.5
OS
MacOS