Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Week formatter in Date filter does not comply to ISO8601 #10314

Closed
yannickadam opened this issue Dec 3, 2014 · 3 comments
Closed

Week formatter in Date filter does not comply to ISO8601 #10314

yannickadam opened this issue Dec 3, 2014 · 3 comments

Comments

@yannickadam
Copy link

ISO8601 mandates that a week starts on Monday, and ends on Sunday.
See plunker here: http://plnkr.co/edit/897MdGDME67aIQmLpzqZ

Fix is proposed in pull request #10313

@pkozlowski-opensource
Copy link
Member

Hmm, I wonder if this shouldn't this be Locale-dependent? ISO8601 is one thing but it seems like different countries are using different notation of the first day of a week. At the same time we don't seem to have this info in the locale files...

@yannickadam
Copy link
Author

@pkozlowski-opensource
From Angular's doc for date filter:
'w': ISO-8601 week of year (0-53)
'ww': ISO-8601 week of year (00-53)

This is a fix to match the documentation. Afterward a specific mecanism could be implemented based on the starting day of the week, but there doesn`t seem to be any ISO standard about it.

Here: http://en.wikipedia.org/wiki/ISO_week_date
The article mentions that it is indeed a drawback of the standard : "Not all parts of the world have a work week that begins with Monday".

@pkozlowski-opensource
Copy link
Member

@yannickadam OK, fair enough. Let's focus on your PR then!

@pkozlowski-opensource pkozlowski-opensource added this to the 1.3.7 milestone Dec 4, 2014
@pkozlowski-opensource pkozlowski-opensource self-assigned this Dec 4, 2014
yannickadam added a commit to yannickadam/angular.js that referenced this issue Dec 4, 2014
…O8601

Week formatter ("w" and "ww") in date filter was considering Sunday as the first day of the week.
To comply with ISO8601, this has been changed to Monday.

Closes angular#10314
@caitp caitp modified the milestones: 1.3.7, 1.3.8 Dec 9, 2014
pkozlowski-opensource added a commit to pkozlowski-opensource/angular.js that referenced this issue Dec 13, 2014
…ting

The existing documentation claims that dateFilter determines week no
according to the ISO8601 standard, but this is not the case as illustrated
by tests in this PR. More specifically, the implementation deviates from
ISO8601 in 2 important aspects:
- impl assumes Sun to be the first day of a week, ISO8601 mandates Mon
- impl allows weeks 0 (for years starting on Fri, Sat) while ISO8601
would mark them as a week 52/53 of a previous year.

Fixes angular#10314
Closes angular#10313
pkozlowski-opensource added a commit to pkozlowski-opensource/angular.js that referenced this issue Dec 13, 2014
…ting

The existing documentation claims that dateFilter determines week no
according to the ISO8601 standard, but this is not the case as illustrated
by tests in this PR. More specifically, the implementation deviates from
ISO8601 in 2 important aspects:
- impl assumes Sun to be the first day of a week, ISO8601 mandates Mon
- impl allows weeks 0 (for years starting on Fri, Sat) while ISO8601
would mark them as a week 52/53 of a previous year.

Fixes angular#10314
Closes angular#10313
pkozlowski-opensource added a commit to pkozlowski-opensource/angular.js that referenced this issue Dec 13, 2014
…ting

The existing documentation claims that dateFilter determines week no
according to the ISO8601 standard, but this is not the case as illustrated
by tests in this PR. More specifically, the implementation deviates from
ISO8601 in 2 important aspects:
- impl assumes Sun to be the first day of a week, ISO8601 mandates Mon
- impl allows weeks 0 (for years starting on Fri, Sat) while ISO8601
would mark them as a week 52/53 of a previous year.

Fixes angular#10314
Closes angular#10313
pkozlowski-opensource added a commit to pkozlowski-opensource/angular.js that referenced this issue Dec 13, 2014
…ting

The existing documentation claims that dateFilter determines week no
according to the ISO8601 standard, but this is not the case as illustrated
by tests in this PR. More specifically, the implementation deviates from
ISO8601 in 2 important aspects:
- impl assumes Sun to be the first day of a week, ISO8601 mandates Mon
- impl allows weeks 0 (for years starting on Fri, Sat) while ISO8601
would mark them as a week 52/53 of a previous year.

Fixes angular#10314
Closes angular#10313
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.