mike-engel / Barnacal

A simple menu bar app for viewing a calendar
Other
37 stars 6 forks source link

Start of week on monday #3

Closed andresgutgon closed 5 years ago

andresgutgon commented 5 years ago

What is this issue?

Hi, I'm using this code daily, I tried because I read about reason and I wanted to try something done in Reason :)

The thing is the calendar always work with with sunday as first day of the week. I would like to change the code to start on monday because that's how works in my country.

andresgutgon commented 5 years ago

I got what I wanted image

doing this: image

andresgutgon commented 5 years ago

It looks like weeks starting on monday are the ISO way

since the ISO week starts with Monday

According to international standard ISO 8601, Monday is the first day of the week. It is followed by Tuesday, Wednesday, Thursday, Friday, and Saturday. Sunday is the 7th and final day.

Although this is the international standard, several countries, including the United States, Canada, and Australia consider Sunday as the start of the week.

I understand this change breaks expectations of people already using this calendar. I think ideally this could be a setting somewhere and persisted in (localStorage maybe?)

I wouldn't mind to try to do a PR but I would love to hear your input first :)

andresgutgon commented 5 years ago

Last thing. date-fns use under the hook javascript Date implementation which have a method getDay. This method doesn't use ISO it use sunday as first day

This is surprising to me :) But I guess it's for historical reasons. Problably javascript implementators were from the US :)

☝️ Just a theory, please correct me if this is totally wrong :)

mike-engel commented 5 years ago

Hey @andresgutgon, thanks for this issue! I've wanted to implement this for some time, but never got the time to work on it.

I'm based in the US as are most of the people I know. Since this little app was made for us, starting the week on Sunday made the most sense. I actually prefer my weeks to start on Monday, but that's another thing.

What I don't want to do here is change the implementation to be a Monday week start for everyone. This is a setting that should either be

Ideally the implementation would be from the OS and not the app. I'm not sure if there's way to do that either from the client or the node app running in the background, but that would certainly be worth some research first.

Let me know what you think. Thanks!

andresgutgon commented 5 years ago

Great! Just to make sure I understand the idea

What I don't want to do here is change the implementation to be a Monday week start for everyone

Agree, it's not fare now and it won't be fare starting on Monday :)

So we've 2 options:

1- Be smart and pick user's OS preferences for start week day if that's something posible. No ui required here?

2- Build somewhere a bit of UI to let users select what they prefer and store in some way in electron app.

It's that correct?

andresgutgon commented 5 years ago

I'll try to take a look. It's not a promise. But I like your calendar and it would be awesome to do it :)

mike-engel commented 5 years ago

Yep, those are the two options I was thinking of. 1 is preferred, but 2 is a nice fallback. I might be able to provide a UI if it comes down to that.

andresgutgon commented 5 years ago

@mike-engel I got something ☝️ Let me know what you think in the PR :)

mike-engel commented 5 years ago

Closed by #4