obsidian-dataview
obsidian-dataview copied to clipboard
Dataview Returned file.cday is not the same as the OS file creation date
What happened?
I enter this query:
LIST dateformat(file.cday,"yyyy-MM-dd") FROM "Periodic Notes/Daily Notes" SORT file.day DESC LIMIT 100
The files being retrieved are listed by the OS (openSUSE Tumbleweed Linux) as follows:
rhack@localhost:/Data2/Planning/Obsidian Vault/Periodic Notes/Daily Notes> ll total 60 -rw-r--r-- 1 rhack rhack 1861 Jan 3 21:15 2024-01-03.md -rw-r--r-- 1 rhack rhack 1861 Jan 5 03:01 2024-01-04.md -rw-r--r-- 1 rhack rhack 1861 Jan 5 19:03 2024-01-05.md -rw-r--r-- 1 rhack rhack 1861 Jan 7 03:44 2024-01-06.md -rw-r--r-- 1 rhack rhack 2065 Jan 8 03:33 2024-01-07.md -rw-r--r-- 1 rhack rhack 2115 Jan 9 03:53 2024-01-08.md -rw-r--r-- 1 rhack rhack 2076 Jan 10 03:48 2024-01-09.md -rw-r--r-- 1 rhack rhack 2076 Jan 11 04:09 2024-01-10.md -rw-r--r-- 1 rhack rhack 2076 Jan 12 03:29 2024-01-11.md -rw-r--r-- 1 rhack rhack 2076 Jan 13 03:54 2024-01-12.md -rw-r--r-- 1 rhack rhack 2076 Jan 14 13:00 2024-01-13.md -rw-r--r-- 1 rhack rhack 2080 Jan 15 04:25 2024-01-14.md -rw-r--r-- 1 rhack rhack 2469 Jan 16 04:13 2024-01-15.md -rw-r--r-- 1 rhack rhack 2469 Jan 17 13:01 2024-01-16.md -rw-r--r-- 1 rhack rhack 2469 Jan 17 22:31 2024-01-17.md
As you can see, they are all in this year in January.
Instead I get this list from dataview:
2024-01-17: 1969-12-31 2024-01-16: 1969-12-31 2024-01-15: 1969-12-31 2024-01-14: 1969-12-31 2024-01-13: 1969-12-31 2024-01-12: 1969-12-31 2024-01-11: 1969-12-31 2024-01-10: 1969-12-31 2024-01-09: 1969-12-31 2024-01-08: 1969-12-31 2024-01-07: 1969-12-31 2024-01-06: 1969-12-31 2024-01-05: 1969-12-31 2024-01-04: 1969-12-31 2024-01-03: 1969-12-31
DQL
LIST dateformat(file.cday,"yyyy-MM-dd") FROM "Periodic Notes/Daily Notes" SORT file.day DESC LIMIT 100
`
JS
No response
Dataview Version
0.5.64
Obsidian Version
1.5.3
OS
Linux
I don't know why the code blocks were reformatted. Sigh...
I just decided to try using the Template creation date format. Guess what? Same problem!
Apparently Obsidian simply can't get a correct creation date from openSUSE Tumbleweed with KDE desktop.
Pathetic.
I did test using the standard Obsidian template {{date}} function and that does return the correct date.
I just spent last night working with the folks over at the Obsidian forums to try to resolve this issue. Since Templater has the same problem, the conclusion we came to is that the vault is corrupted. So I'm going to back up everything (which I do anyway every night), wipe the vault and reinstall Obsidian. If the problem persists after that, I think the issue is related to how the Linux btrfs file system stores the creation date of files. It may be that Obsidian - and by extension some of the plugins - are still looking at ctime instead of crtime or otime for the file creation date. The plugins appear to be obtaining a zero date which then defaults to the UNIX epoch time date.
We'll see how wiping the vault goes.
OK, I wiped the vault, uninstalled and reinstalled Obsidian.
With an empty vault, I created several simple text files with title only. The creation dates shown from the Files pane hover popup were correct.
I then installed Dataview and entered this query: TABLE file.day, file.cday, file.ctime, file.mday, file.mtime, typeof(file.cday) SORT file.day DESC LIMIT 100
Which returned this result:
Which is correct.
So apparently it was a corrupted vault that caused the problem and not Dataview. So I think we can close this bug report out as solved.
feel free to close the issue then. (I can't)