You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is that you are providing a string (startOfWeek="1") rather than a number (startOfWeek={1}).
The labels for the days are constructed by the expression dowLabels[(labelIndex + startOfWeek) % 7].
If startOfWeek is a string, then the + operator is interpreted as string concatenation rather than addition: labelIndex is converted to a string, with a 1 added to the end. This string is then cast back to a number when the modulus (%) is taken.
The library could be made more robust against misuse by using the parseNumber function (dowLabels[(labelIndex + parseNumber(startOfWeek, 10)) % 7]) or an extra + operator (dowLabels[(labelIndex + +startOfWeek) % 7] - note the space to distinguish from a ++ increment operator) to cast startOfWeek to a number.
Describe the bug
If you choose that the "startOfWeek" is, e.g. 1 for Monday, the day of the week labels get scrambled.
To Reproduce
startOfWeek="1"
Expected behavior
I expect it to not be scrambled.
Screenshots
Desktop
Smartphone - Didn't test
Additional context
The text was updated successfully, but these errors were encountered: