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

[DatePicker] Change the behavior of firstDayOfWeek to follow ISO #2980

Closed
oliviertassinari opened this issue Jan 19, 2016 · 5 comments
Closed
Labels
component: date picker This is the name of the generic UI component, not the React module! component: pickers This is the name of the generic UI component, not the React module!

Comments

@oliviertassinari
Copy link
Member

I'm moving the conversion here.

Change the default value of firstDayOfWeek from 0 to 1

@oliviertassinari Shouldn't by standard Monday be 0? @mbrookes I'm no expert on the standard. Is defaulting to 1 (yet starting from Saturday) against the standard?

@alitaheri I'm not sure to follow your point. We have 0=Sunday and 1=Monday. Do you want to change it to 0=Monday?

What I mean is, if by standard the start of the week is Monday, then it's more convenient to start COUNTING from Monday too. in other words it will be like: 6=Sunday and 0=Monday and so on. with default still being 0. instead of changing the default to 1 we rotate the days the numbers correspond to. So the standard is respected in every aspect.

I thought the same, which is why I raised the question of the default in the PR, since changing the numbering in a future release could have more impact than just changing the default.
However, Date.prototype.getDay() has Sunday=0, so at least it's consistent with that.

Let's see what moment is doing. you have:

var moment = require("moment")
moment.locale('fr');

console.log(moment().isoWeekday(0).format("dddd")); // Sunday
console.log('');
console.log(moment().weekday(0).format("dddd")); // (locale aware) Monday

(https://tonicdev.com/569e2ecaabe29a0c00e1727c/569e314e3df26e0d00fc271d)

Looks like 0 is the iso weekday for Sunday and that we shouldn't change anything 😁.

@oliviertassinari oliviertassinari added this to the 0.15.0 Release milestone Jan 19, 2016
@oliviertassinari oliviertassinari mentioned this issue Jan 19, 2016
8 tasks
@mbrookes
Copy link
Member

Related to #1839.

@mbrookes
Copy link
Member

Why is this closed? Do we not still want firstDayOfWeek to follow ISO (Monday)?

It just means the default is 1, rather than 0. I think the conversation got derailed slightly by discussing what 0 should be, but that is agreed - 0 = Sunday.

What should the default be?

@oliviertassinari
Copy link
Member Author

@mbrookes You are right, my bad. I think that firstDayOfWeek default value should be 1 = Monday.

@mbrookes
Copy link
Member

I have a hacky fix for #1839. I'll submit a PR for them both later.

@iheidt
Copy link

iheidt commented May 24, 2017

The default for firstDayOfWeek should be 0 = Sunday.

Look at Google examples:
https://material.io/guidelines/components/pickers.html#pickers-date-pickers

@zannager zannager added component: date picker This is the name of the generic UI component, not the React module! component: pickers This is the name of the generic UI component, not the React module! labels Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: date picker This is the name of the generic UI component, not the React module! component: pickers This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

4 participants