Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not get calendar date from frontmatter #83

Open
fedorbass opened this issue Jun 28, 2023 · 4 comments
Open

can not get calendar date from frontmatter #83

fedorbass opened this issue Jun 28, 2023 · 4 comments

Comments

@fedorbass
Copy link

trying to get the date from page.date in my case, doesn't work. Format is YYYY-MM-DD

my sample:

date: 2023-04-03
activeEnergyKcal: 764.5369999999999
source: Apple Health

@adrianratajczak
Copy link

I also have a problem with this. I am not able to read the date which is available by default page.file.ctime.
Unfortunately, I can't create a file with the right name, so I need to grab a variable to display my results.
So far, however, without success

@fedorbass
Copy link
Author

I also have a problem with this. I am not able to read the date which is available by default page.file.ctime. Unfortunately, I can't create a file with the right name, so I need to grab a variable to display my results. So far, however, without success

Have you got any solution so far?

@arfx
Copy link

arfx commented Oct 23, 2023

Same issue here, I get only some "random" (they probably mean something but I don´t know what) numbers, when I output the property.

Maybe they could convert back to "yyyy-MM-dd" somehow.
image

@Tobias380
Copy link

Tobias380 commented Feb 3, 2024

Came up against this issue as well. I think it's because the front matter property stores the date in a UNIX Epoch format, whereas the calendar api is expecting it as a string "YYY-MM-DD". I managed to get round this by converting the front matter property in the calendar DataView JS loop.

//DataviewJS loop 
for (let page of dv.pages('"Completed"')){ 

var date = new Date(page.date);
var dateText = date.getFullYear() + "-0"+(date.getMonth() +1)+"-"+date.getDate();

	calendarData.entries.push({ 
		date: dateText, 
		color: "orange", 
	}) 
} renderHeatmapCalendar(this.container, calendarData) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants