This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
calendar, datepicker: when local tz is GMT+X, using ng-model-options to specify the tz causes previous day to be selected #12000
Closed
Description
Bug
Demo and steps to reproduce the issue
Demo URL (required)*: https://material.angularjs.org/1.1.24/demo/datepicker#ng-model-options-timezone
Detailed Reproduction Steps
- Ensure that your device's timezone is set to GMT+X like GMT+5:00
- Click a date in the demo's calendar
- Click the same date in the demo's datepicker
Explain the expected behavior
The behavior should be the same as for a GMT-5:00 timezone. The UTC time should be midnight and the UTC date should be the date clicked.
Explain the current behavior
The behavior is not the same as for a GMT-5:00 timezone. The UTC time is midnight and the UTC date is 1 day before the date clicked.
Discuss the use-case or motivation for changing the existing behavior
Correctness.
List the affected versions of AngularJS, Material, OS, and browsers
- AngularJS: 1.8.0
- AngularJS Material: 1.1.24
- OS: macOS
- Browsers: Chrome 84.0.4147.135
Add anything else we should know
There is an issue where the stand-alone calendar and calender in a datepicker, when a date is clicked on (in a GMT+X timezone when using ng-model-options="{timezone: 'UTC'}"
), selects the previous date:
In this case, 6/19 is manually clicked upon in the stand-alone calendar and calender in the datepicker: