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

Not working with 2023? #57

Open
fonky415 opened this issue Jan 1, 2023 · 5 comments
Open

Not working with 2023? #57

fonky415 opened this issue Jan 1, 2023 · 5 comments

Comments

@fonky415
Copy link

fonky415 commented Jan 1, 2023

Calendar continues to show 2022 days. Do I need to do something to switch to 2023?
Screenshot 2023-01-02 at 12 11 30 AM

@slillig
Copy link

slillig commented Jan 2, 2023

Getting same when changing year to year: 2023 from the examples.

@Richardsl
Copy link
Owner

Do you have the year variable set in your code? If you remove it completely, it should default to the current year

@fonky415
Copy link
Author

fonky415 commented Jan 2, 2023

This is the code:

`dataviewjs

dv.span("Mood (1-10)")

const hue1 = 13
const hue2 = 132

const calendarData= {
intensityScaleStart: 1,
intensityScaleEnd: 9,
colors: {
red2green: [
hsl(${hue1}, 100%, 37%), // 1 - darkest red
hsl(${hue1}, 100%, 50%), // 2 -
hsl(${hue1}, 100%, 60%), // 3 -
hsl(${hue1}, 100%, 77%), // 4 - lightest red
hsl(${hue1}, 100%, 90%), // 5 - neutral gray
hsl(${hue2*0.7}, 70%, 72%), // 6 - lightest green
hsl(${hue2*0.85}, 43%, 56%), // 7 -
hsl(${hue2}, 49%, 36%), // 8 -
hsl(${hue2}, 59%, 24%), // 9 - darkest green
],
},
entries: []
}

for(let page of dv.pages('"Life/Journal/2023/Daily"').where(p=>p.mood)){

calendarData.entries.push({
	date: page.file.name,
	intensity: page.mood,
	content: await dv.span(`[](${page.file.name})`),
	})

}

renderHeatmapCalendar(this.container, calendarData)
`

I just copied and pasted the thing from the example vault because I was too lazy to learn how to make it. 2022 worked fined for me. I can't find any variable with 2023.

@slillig
Copy link

slillig commented Jan 2, 2023

I originally tried to update the year to 2023 but removing the year: variable altogether seems to be working now.

@maskedmage77
Copy link
Contributor

maskedmage77 commented Jan 2, 2023

It seems to be an issue with the Timezone of the user when the code runs

new Date(e.date).getFullYear()

on line 84 of main.ts. It looks like the easiest way to fix this issue is to add T00:00 to e.date when the date is created.

This was referenced Jan 2, 2023
Richardsl pushed a commit that referenced this issue Jan 12, 2023
* added + 1 to date comparison to fix issue #57

* added T00:00 to new dates to respect time zones properly.
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