Closed akosiaris closed 1 year ago
Can you give us steps to repro?
Hello,
I cannot reproduce the behaviour with the provided DQL. I think the cause could be on your setup, that Obsidian cannot read the correct creation data.
Could you try to log the pages to the developer console and inspect the date there?
```dataviewjs
console.log(dv.pages('"Daily Notes"'))
Hello,
I cannot reproduce the behaviour with the provided DQL.
I would be surprised if you did, this is too basic functionality to not be something weird in my local instance.
I think the cause could be on your setup, that Obsidian cannot read the correct creation data.
I am thinking the same thing, I am just not familiar enough with Obsidian to dig in more without some guidance.
Could you try to log the pages to the developer console and inspect the date there?
```dataviewjs console.log(dv.pages('"Daily Notes"'))
And that's what I was looking for! OK, this is weird. After expanding the Proxy object, and the enclosed Array, drilling down to a value in the array, I get this (I snipped all the apparently unrelated stuff like etags/tags/inlinks/outlinks/tasks/lists etc).
{
"file": {
"path": "Daily Notes/2022-12-22.md",
"folder": "Daily Notes",
"name": "2022-12-22",
"link": {
"path": "Daily Notes/2022-12-22.md",
"embed": false,
"type": "file"
},
"ctime": "1970-01-01T02:00:00.000+02:00",
"cday": "1970-01-01T00:00:00.000+02:00",
"mtime": "2022-12-22T10:55:03.066+02:00",
"mday": "2022-12-22T00:00:00.000+02:00",
"size": 520,
"starred": false,
"frontmatter": {
"created": "2022-12-22",
"tags": "daily"
},
"ext": "md",
"day": "2022-12-22T00:00:00.000+02:00"
},
"created": "2022-12-22T00:00:00.000+02:00",
"tags": "daily"
}
Timezone is correct, I am at UTC+2.
Digging deeper into cday
property, I see a ts
attribute with a value of -7200000
. I am assuming this is a timestamp and in fact in milliseconds. Note that the mday
property (which works quite fine and I should have noted it already), also a DateTime has the value 1671660000000
for it (which is the 00:00 local time today, so correct). The day
property works fine as well.
I tried looking more into it, but I arrive at the FileStats interface of Obsidian API (https://github.com/obsidianmd/obsidian-api/blob/master/obsidian.d.ts#L1246) and there I am stuck without any obvious path.
Adding the output of the stat CLI command on that file. Modify matches perfectly what mtime reports
Daily Notes$ stat 2022-12-22.md
File: 2022-12-22.md
Size: 520 Blocks: 8 IO Block: 4096 regular file
Device: fe03h/65027d Inode: 4745811 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ alex) Gid: ( 1000/ alex)
Access: 2022-12-22 10:55:03.085900696 +0200
Modify: 2022-12-22 10:55:03.065902436 +0200
Change: 2022-12-22 10:55:03.065902436 +0200
Birth: 2022-12-22 10:55:03.065902436 +0200
Can you give us steps to repro?
Since this was asked too, I just started a new vault, went straight to install and enable the dataview plugin, created 1 file and put it in
LIST file.cday
I get back a list with the name of the file I just created and January 01, 1970
next to it.
Obsidian was installed weeks ago with flatpak install --user md.obsidian.Obsidian
-7200000 is btw -2 hours in milliseconds. Given I am at UTC +2 this is probably related
Hello,
As far as I can tell, dataview is collecting the ctime/cday directly from Obsidian (here) - that would mean that Obsidian itself does not have access to the creation date, defaulting to 0.
I am not aware if there's a possibility to see the creation date directly from Obsidian to see if it's already wrong there ....
You could go to the graph and hit the magic wand on the right, starting a timelapse animation - and if everything just popping in in the exact same time, I'd presume it's all on the same creation date.
I sadly have no experience with flatpack whatsoever and cannot say if this is the cause. Dataview cannot do anything about it if the creation date is not available to Obsidian itself, though.
EDIT: seemingly you can also output the creation date with help of templater: https://forum.obsidian.md/t/how-to-retrieve-creation-date-from-metadata-of-a-note/31246/5 If you have this plugin, you could try if you get the same behaviour.
Hello,
As far as I can tell, dataview is collecting the ctime/cday directly from Obsidian (here) - that would mean that Obsidian itself does not have access to the creation date, defaulting to 0.
At least that it provides the wrong value to the API under some circumstances
I am not aware if there's a possibility to see the creation date directly from Obsidian to see if it's already wrong there ....
You could go to the graph and hit the magic wand on the right, starting a timelapse animation - and if everything just popping in in the exact same time, I'd presume it's all on the same creation date.
That one doesn't exhibit the issue. Notes pop up one by one as expected. It was a good suggestion though!
EDIT: seemingly you can also output the creation date with help of templater: https://forum.obsidian.md/t/how-to-retrieve-creation-date-from-metadata-of-a-note/31246/5 If you have this plugin, you could try if you get the same behaviour.
Yeah, it appears templater suffers from the exact same issue. I used the exact template in the link you posted and just got
---
creation_date: 1970-01-01 02:00
modification_date: Sunday, 25th December 2022, 20:55:07
---
So, this is definitely larger than this plugin. Thanks for helping with narrowing this down. I 'll close this issue and try to bring it with Obsidian developers. If I have something, I 'll make sure to post an update here.
Coming back to this as promised, a search in the obsidian forum reveals this has been reported multiple times:
Looks like it can't be solved, at least not easily.
A workaround is being proposed in https://forum.obsidian.md/t/native-yaml-override-for-filesystem-creation-time/41240 which is, ironically, to what I, independently, ended up doing myself (my yaml stanza is called created
, not creation
)
What happened?
I tried the supplied DQL and instead of seeing the actual creation dated listed for my files, I see
January 01, 1970
. I suppose that's not the intent offile.cday
😄Files in the filesystem definitely have the correct dates per a stat command.
If it makes any difference, Obsidian is installed via Flatpak.
DQL
JS
No response
Dataview Version
0.5.47
Obsidian Version
1.1.8
OS
Windows