Richardsl / heatmap-calendar-obsidian

An Obsidian plugin for displaying data in a calendar similar to the github activity calendar
Apache License 2.0
614 stars 102 forks source link

can not get calendar date from frontmatter #83

Open fedorbass opened 1 year ago

fedorbass commented 1 year ago

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 commented 1 year ago

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 commented 11 months ago

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 commented 10 months ago

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 commented 6 months ago

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)