You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
datepicker: with UTC timezone set doesn't handle time offset +2:00 #12028
Detailed Reproduction Steps (With user interaction)
Create a controller with a md-datepicker in the template
Set the ng-model-options to {timezone:'UTC'}
Load the view and open the datepicker. The date will be incorrectly displayed in the datepicker and the date will have an updated time offset.
The time for the date is now 00:00 (but with correct timezone) instead of the correct timezone adjustment
See demo url (1)
Detailed Reproduction Steps (Without interaction)
This step is a bit harder to reproduce as it seems to depend on what is loaded in the view. I've been able to reproduce this in the example for timezone settings at https://material.angularjs.org/latest/demo/datepicker, I've copied the demo to codepen where it seems to appear as long as the calendar is loaded together with the datepicker. I've also experienced this issue without any calendar being loaded in the view.
Create a view with a calendar and a datepicker component
Set the ng-model-options to {timezone:'UTC'}
Load the view, the datepicker timestamp should now be "00:00" instead of the correct offset
Any selection of a date will update the time offset properly.
Removing the calendar will prevent the problem from occurring.
See demo url (2)
Explain the expected behavior
Time for the date should not be affected when opening or loading the datepicker.
Explain the current behavior
When setting an initial date the time part of the date will be affected when either opening up the datepicker and closing it or during the initial load of the datepicker in some scenarios. This is not expected bahavior.
Discuss the use-case or motivation for changing the existing behavior
The current behavior is unexpected and may lead to an invalid date being selected when using the datepicker component.
List the affected versions of AngularJS, Material, OS, and browsers
AngularJS: 1.8.1, 1.8.0
AngularJS Material: 1.2.1, 1.1.26
OS: Windows 10
Browsers: Chrome 85.0.4183.12
Add anything else we should know
Screenshots
When opening the datepicker
During first load
After a date is selected after first load the time offset is updated correctly
changed the title [-]datepicker: Datepicker with timezone set doesn't handle time offset correctly in some cases[/-][+]datepicker: with UTC timezone set doesn't handle time offset +2:00[/+]on Oct 10, 2020
Activity
nicklastromb commentedon Oct 7, 2020
May have created a duplicate of #12026 if I understand that one correctly.
Splaktar commentedon Oct 10, 2020
Thank you for this more detailed report. I still don't have enough information in that other issue to take any action.
I can't reproduce your report in the GMT-4:00 timezone, but I'll try doing some testing with GMT+2:00.
[-]datepicker: Datepicker with timezone set doesn't handle time offset correctly in some cases[/-][+]datepicker: with UTC timezone set doesn't handle time offset +2:00[/+]Splaktar commentedon Oct 10, 2020
OK, I can reproduce this in the GMT+2:00 timezone. Investigating...
fix(datepicker): time is modified before even selecting a date
fix(datepicker): time is modified before even selecting a date
Splaktar commentedon Oct 11, 2020
OK, I've got a fix for this in PR #12030.
fix(datepicker): time is modified before even selecting a date