You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am comparing the number of days between two dates. In the provided DQL snippet, the .days output jumps from 27 to 30 even though I only changed the date by 1 day.
It seems this is because the calculation goes from weeks to month (30 days).
I'm not sure why Dataview does this, or if this is an effect coming from the Luxon date library. I reckon it's an attempt to produce humanised duration formats. When I've come across this issue myself, I've either switched to using dataviewjs and using the moment.js library directly, or done the calculations using epoch times (aka seconds since 1970-01-01).
Come to think of it, maybe it could be a possible workaround to provide a function like epochday( date ) which produce the number of days since epoch, for usage in calculations like these? Then it could look like: `= epochday(date(2024-10-30)) - epochday(date(2024-10-02)) `, and you'd get the pure day number calculation...
What happened?
I am comparing the number of days between two dates. In the provided DQL snippet, the
.days
output jumps from 27 to 30 even though I only changed the date by 1 day.It seems this is because the calculation goes from weeks to month (30 days).
Is there a better way to write this calculation?
DQL
JS
No response
Dataview Version
0.5.67
Obsidian Version
1.7.4
OS
MacOS
The text was updated successfully, but these errors were encountered: