-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Documentation for input[week] doesn't mention what will be the underlying Date object #15883
Comments
I wouldn't say the I'm abit confused as it looks like it defaults to wednesdays for me. I guess it would be good to update the docs. (edit: it appeared to be thursday local time (UTC+2), but was displayed wednesday due to UTC) |
It seems to be locale-dependent also. In France, it seems to be thursday, as the first day of week is monday. |
It seems to be using thursday as the day by adding a certain factor of 7 days to the firstThursday of that year: angular.js/src/ng/directive/input.js Line 1359 in 0304383
angular.js/src/ng/directive/input.js Line 1369 in 0304383
Any idea what the reason for this is @gkalpak ? |
From WikiPedia on ISO 8601:
So, we find the first Thursday and then count Thursdays to find the week number. Docs improvements are always welcome 😃 |
By looking at the ISO spec, I think it makes perfect sense to pick thursday. As it's possible that any other day of that week (when using thursday to calculate week number) could be in a different month/year (so different Gregorian calendar year as you said). |
@Vicente69 or @frederikprijck, if you feel like submitting PR adding a note to the docs, please do 😁 |
I'm submitting a ...
Current behavior:
The documentation for angular input[week] says the input text 'yyyy-Www' is transformed into a Date object. But it can hardly be used as the documentation doesn't say exactly which day of the week, and what time is put in the Date object.
Expected / new behavior:
The documentation shall mention what will be the underlying Date object.
Minimal reproduction of the problem with instructions:
Angular version: 1.6.2
Browser: [all]
Anything else:
The text was updated successfully, but these errors were encountered: