Datepipe formating with timezone - incorrect date in date when is winter time changed to summer time · Issue #49540 · angular/angular · GitHub
Skip to content

Datepipe formating with timezone - incorrect date in date when is winter time changed to summer time #49540

Description

@MartinMilata

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

common

Is this a regression?

Yes

Description

In the date when was changed winter time to summer time, the formating for specific hour(01:00 is the same like 02:00 ) does not work correctly..
My timezone in windows is UTC+1 - Prague - here the datepipe does not work correctly.. If I set it in windows timezone UTC, it is ok...

toISOString | UTC | +0000 | +0060

2022-03-27T00:00:00.000Z | 3/27/22, 12:00 AM | 3/27/22, 12:00 AM | 3/27/22, 1:00 AM
2022-03-27T01:00:00.000Z | 3/27/22, 1:00 AM | 3/27/22, 1:00 AM | 3/27/22, 3:00 AM
2022-03-27T02:00:00.000Z | 3/27/22, 3:00 AM | 3/27/22, 3:00 AM | 3/27/22, 3:00 AM
2022-03-27T03:00:00.000Z | 3/27/22, 3:00 AM | 3/27/22, 3:00 AM | 3/27/22, 4:00 AM

2021-03-28T00:00:00.000Z | 3/28/21, 12:00 AM | 3/28/21, 12:00 AM | 3/28/21, 1:00 AM
2021-03-28T01:00:00.000Z | 3/28/21, 1:00 AM | 3/28/21, 1:00 AM | 3/28/21, 3:00 AM
2021-03-28T02:00:00.000Z | 3/28/21, 3:00 AM | 3/28/21, 3:00 AM | 3/28/21, 3:00 AM
2021-03-28T03:00:00.000Z | 3/28/21, 3:00 AM | 3/28/21, 3:00 AM | 3/28/21, 4:00 AM

2020-03-29T00:00:00.000Z | 3/29/20, 12:00 AM | 3/29/20, 12:00 AM | 3/29/20, 1:00 AM
2020-03-29T01:00:00.000Z | 3/29/20, 1:00 AM | 3/29/20, 1:00 AM | 3/29/20, 3:00 AM
2020-03-29T02:00:00.000Z | 3/29/20, 3:00 AM | 3/29/20, 3:00 AM | 3/29/20, 3:00 AM
2020-03-29T03:00:00.000Z | 3/29/20, 3:00 AM | 3/29/20, 3:00 AM | 3/29/20, 4:00 AM

2019-03-31T00:00:00.000Z | 3/31/19, 12:00 AM | 3/31/19, 12:00 AM | 3/31/19, 1:00 AM
2019-03-31T01:00:00.000Z | 3/31/19, 1:00 AM | 3/31/19, 1:00 AM | 3/31/19, 3:00 AM
2019-03-31T02:00:00.000Z | 3/31/19, 3:00 AM | 3/31/19, 3:00 AM | 3/31/19, 3:00 AM
2019-03-31T03:00:00.000Z | 3/31/19, 3:00 AM | 3/31/19, 3:00 AM | 3/31/19, 4:00 AM

dates: Array = [];
ngOnInit(): void {
this.initialize();
}
initialize() {

this.dates.push(new Date('2022-03-27T00:00:00.000Z'));
this.dates.push(new Date('2022-03-27T01:00:00.000Z'));
this.dates.push(new Date('2022-03-27T02:00:00.000Z'));
this.dates.push(new Date('2022-03-27T03:00:00.000Z'));

this.dates.push(new Date('2021-03-28T00:00:00.000Z'));
this.dates.push(new Date('2021-03-28T01:00:00.000Z'));
this.dates.push(new Date('2021-03-28T02:00:00.000Z'));
this.dates.push(new Date('2021-03-28T03:00:00.000Z'));

this.dates.push(new Date('2020-03-29T00:00:00.000Z'));
this.dates.push(new Date('2020-03-29T01:00:00.000Z'));
this.dates.push(new Date('2020-03-29T02:00:00.000Z'));
this.dates.push(new Date('2020-03-29T03:00:00.000Z'));

this.dates.push(new Date('2019-03-31T00:00:00.000Z'));
this.dates.push(new Date('2019-03-31T01:00:00.000Z'));
this.dates.push(new Date('2019-03-31T02:00:00.000Z'));
this.dates.push(new Date('2019-03-31T03:00:00.000Z')); 

}

toISOString UTC +0000 +0060
{{date.toISOString()}} {{date | date:'short' :'UTC'}} {{date | date:'short' :'+0000'}} {{date | date:'short' :'+0060'}}

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

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

Angular CLI: 15.2.4
Node: 16.17.0
Package Manager: npm 8.15.0
OS: win32 x64

Angular: 15.2.3
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1502.4
@angular-devkit/build-angular   15.2.4
@angular-devkit/core            15.2.4
@angular-devkit/schematics      15.2.4
@angular/cli                    15.2.4
@schematics/angular             15.2.4
rxjs                            7.8.0
typescript                      4.9.5

Anything else?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions