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
isoWeekday(String) inconsistent with isoWeekday(Number) on Sunday #2704
Comments
That's correct. This Sunday is |
I figured that's how it's implemented and understand what you mean now, but the result was a bit counter-intuitive from my point of view. The documentation says:
So in an ISO week, 7 is always Sunday. The documentation of the alias says:
So with those two pieces of information it might be a little bit confusing when you do:
I would expect it to give the same result as Apart from that, if you say "Sunday" is an alias for 0, this might conflict with the documentation here: If the locale assigns Monday as the first day of the week, Not trying to brag, just want to explain why this was unclear for me. Maybe a note in the documentation stating that "sunday" is an alias for 0 would be useful. |
Fair point. It could be that it should be an alias for 7 or that 0 vs 7 should behave differently. I'm not immersed enough in the details to be sure what the right thing to do is, so I'll just leave this open. |
Taking a look at this again. The docs only talk about being able to pass Then, I'd agree that for |
A PR would be welcome. First, submit a PR to fix the behavior of the |
Bug Fix #2704 - isoWeekday(String) inconsistent with isoWeekday(Number)
I'm trying to generate date via year, week and day number i.e the problem i'm facing when i want to get year and week from generated date |
isoWeekday(7) gives me Sunday of this iso week (monday-sunday)
isoWeekday("Sunday") gives me the Sunday of previous iso week
version: https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js
The text was updated successfully, but these errors were encountered: