vue-calendar-heatmap icon indicating copy to clipboard operation
vue-calendar-heatmap copied to clipboard

Auto detect first day of the week

Open nagos opened this issue 4 years ago • 12 comments

Used weekstart package to detect sunday or monday as start of the week.

You can check this in recent Chrome. Dev toosl-sensors-location. Change between San Francisco and London.

https://github.com/julienr114/vue-calendar-heatmap/issues/1

nagos avatar Sep 09 '20 11:09 nagos

I see no changes to the date-squares, does this shift the data to the right place?

noerw avatar Dec 22 '20 16:12 noerw

I used this example for testing. Put it in project folder and npm run build.

https://gist.github.com/nagos/4e38f883a1e9c90cee0476313e6c6dce

Location set to San Francisco san-francisco

Location set to London london

nagos avatar Dec 22 '20 18:12 nagos

nice! @julienr114 can this be merged & released?

noerw avatar Dec 22 '20 18:12 noerw

~~Just chiming in to point out that the weekday package wasn't updated since a year and it looks like there are shorter methods to get the first day of the week~~ Did a bit more research, looks like this is not that of an easy problem to solve and the link I posted earlier does not solve it.

However, date-fns seems to offer a simple but (more importantly) tree-shakable method which does not introduce 4MB of new dependencies, maybe that'd be better suited?

just my two cents :slightly_smiling_face:

kolaente avatar Dec 24 '20 01:12 kolaente

However, date-fns seems to offer a simple but (more importantly) tree-shakable method which does not introduce 4MB of new dependencies, maybe that'd be better suited?

startOfWeek from date-fns gives date of first day of the week (i.e. 21 of december). And you have to provide variable weekStartsOn. We need to know weekStartsOn, so this does not help.

nagos avatar Dec 24 '20 12:12 nagos

And you have to provide variable weekStartsOn. We need to know weekStartsOn, so this does not help.

I think this is a great lesson for me to not write half thought-through comments on PRs in the middle of the night :)

Sorry for the noise.

kolaente avatar Dec 24 '20 13:12 kolaente

Is there any reason for this not to be merged?

E1k3 avatar Jul 19 '22 14:07 E1k3

Would like to re-iterate this, the PR looks simple enough and there are a lot of places that would benefit from this change.

https://www.timeanddate.com/calendar/days/first-day-of-the-week.html

bendem avatar Mar 14 '23 09:03 bendem

Upvoting for merge. Is there something blocking PR ?

KazzmanK avatar May 07 '23 20:05 KazzmanK

Just booping this thread, since Gitea is also waiting for this feature to be added: https://github.com/go-gitea/gitea/issues/6058

jjbankert avatar Oct 11 '23 19:10 jjbankert

Just booping this thread, since Gitea is also waiting for this feature to be added: go-gitea/gitea#6058

Gitea uses Vue-3 fork

https://github.com/razorness/vue3-calendar-heatmap/issues/19

KazzmanK avatar Oct 11 '23 19:10 KazzmanK

My bad, whoops. I hope that people using this component still appreciate the boop ;)

jjbankert avatar Oct 12 '23 17:10 jjbankert