blacksmithgu / obsidian-dataview

A data index and query language over Markdown files, for https://obsidian.md/.
https://blacksmithgu.github.io/obsidian-dataview/
MIT License
6.94k stars 411 forks source link

Incorrect number of days #1504

Open pebbe opened 1 year ago

pebbe commented 1 year ago

What happened?

I use this code:

```dataview
table (date("2022-11-25") - date("2022-10-24")).days as "days" 
where 1
limit 1
```

I get the value 31 for days. It should be 32.

DQL

No response

JS

No response

Dataview Version

0.5.47

Obsidian Version

1.0.0

OS

Linux

mnvwvnm commented 1 year ago

I think this is related with Luxon (the used DateTime library), in particular the way as Luxon deal with months: it converts 1 month = 30 days, ignoring the 31 days cases.

ruinshe commented 1 year ago

I found similar issue, and post a sample here for tracking ;-)

correct: `=(date("2022-10-29T12:19:00Z") - date("2022-10-01T13:30:00Z")).days` => 27.95
incorrect: `=(date("2022-10-29T15:19:00Z") - date("2022-10-01T13:30:00Z")).days` => 30.07, should be 28.07