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
Fixed week number calculation for non standard dow/doy combinations. #2188
Conversation
…Added tests for all combinations
If it works, this might fix #2115. |
I'm not sure this is a complete fix. You may need to also fix the logic in the |
As mentioned in the discussion in #2115, this fix uses the way for |
@gregor-rayman @usmonster I agree the current values are confusing, but I think that is being used by all localization software around, including CLDR. What is the usecase for a start of week that doesn't exist in real life? :) @gregor-rayman you also have to rebase to latest develop. Check https://github.com/moment/moment/blob/develop/CONTRIBUTING.md for more info. |
@ichernev, thanks, I will rebase today :) The usecase for start of week that doesn't exist in real life is indeed useless. But grey is the theory and green is the tree of life, so I am quite certain that some companies use non-standard week numbering for their production rhythm. (e.g. some of our customers in Europe start their week on Saturday). I don't have a problem with the slightly confusing settings, the problem I have that currently the parsing of weeks in the Arabic numbering produces wrong values - it shifts the week number by 1. This pull request fixes it. Thanks in advance for merging after I rebase. |
@ichernev Thanks for mentioning CLDR, though I've been looking for any other authoritative code or specification that defines It does indeed seem odd and confusing that moment allows |
I have replaced this pull request with #2336 based on the current develop. |
For some non standard combination of dow and doy the computation of the week number would return a wrong week number. This pull request fixes the problem.
Also added tests for all 7*7 dow/doy combinations.