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

docs(dateFilter): fix docs to match implementation for week no formatting #10445

Closed

Conversation

pkozlowski-opensource
Copy link
Member

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 #10314
Closes #10313

This PR is an alternative approach to the one proposed in #10313. Merging #10313 would introduce a breaking change without assuring full compliance with ISO-8601

@googlebot
Copy link

CLAs look good, thanks!

@@ -356,8 +356,8 @@ var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZEw']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d
* * `'.sss' or ',sss'`: Millisecond in second, padded (000-999)
* * `'a'`: AM/PM marker
* * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200)
* * `'ww'`: ISO-8601 week of year (00-53)
* * `'w'`: ISO-8601 week of year (0-53)
* * `'ww'`: Week of year, padded (00-53). Week 01 is assumed to contain the first Thur of a year.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not really assuming anything, I think it is better phrased as
Week of the year (00-53). Week 01 is the week with the first Thursday of the year

@lgalfaso
Copy link
Contributor

otherwise, LGTM

…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
Copy link
Member Author

Thnx @lgalfaso - updated docs as suggested.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Week formatter in Date filter does not comply to ISO8601
3 participants