Skip to content

ISO week-numbering year incorrect for some years #53813

@chucknelson

Description

@chucknelson

Which @angular/* package(s) are the source of the bug?

common

Is this a regression?

No

Description

When using the ISO week-numbering year format in a date pipe (e.g., 'YYYY' format string), for some years it seems to calculate incorrectly versus other common date libraries and other external sources like various calculators on the web.

Below is a quick summary looking at the calendar year and ISO week-numbering years as calculated by different implementations for December 31st (one of the days where the ISO week-number year often differs from the calendar year). The yellow rows are examples of years where the date pipe seems to be incorrect.

image

This was sanity checked against independent sources on the web, such as:

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/stackblitz-starters-tdkfa6?file=src%2Fmain.ts

Note that the reproduction uses the most current versions of packages at this time, including Angular 17.

Please provide the exception or error you saw

See description for examples of the issue.

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 15.2.10
Node: 16.20.2
Package Manager: yarn 1.22.19
OS: darwin arm64

Angular: 15.2.10
... animations, cli, common, compiler, compiler-cli, core
... elements, forms, localize, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1502.10
@angular-devkit/build-angular   15.2.10
@angular-devkit/core            15.2.10
@angular-devkit/schematics      13.3.11
@schematics/angular             15.2.10
rxjs                            7.8.1
typescript                      4.9.5

Anything else?

Versions of other date libraries:

  • date-fns@2.29.3
  • luxon@3.4.4

As noted above, the reproduction in StackBlitz uses the most current versions of packages at this time, including Angular 17.

Metadata

Metadata

Assignees

Labels

area: commonIssues related to APIs in the @angular/common packagebugcore: pipes

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions