Skip to content
This repository has been 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
Splaktar opened this issue Aug 28, 2020 · 0 comments · Fixed by #12004
Assignees
Labels
has: Pull Request A PR has been created to address this issue i18n: localization This issue is related to internationalization P2: required Issues that must be fixed. resolution: fixed type: bug
Milestone

Comments

@Splaktar
Copy link
Member

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

  1. Ensure that your device's timezone is set to GMT+X like GMT+5:00
  2. Click a date in the demo's calendar
  3. 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:
Screen Shot 2020-08-28 at 05 27 31

In a GMT-X timezone, this works fine:
Screen Shot 2020-08-27 at 22 29 08

@Splaktar Splaktar added this to the 1.2.1 milestone Aug 28, 2020
@Splaktar Splaktar self-assigned this Aug 28, 2020
@Splaktar Splaktar added P2: required Issues that must be fixed. type: bug labels Aug 28, 2020
@Splaktar Splaktar added the i18n: localization This issue is related to internationalization label Aug 28, 2020
Splaktar added a commit that referenced this issue Aug 28, 2020
- simplify `$$mdDateUtil.removeLocalTzAndReparseDate()`

Fixes #12000
@Splaktar Splaktar modified the milestones: 1.2.1, 1.1.25 Aug 28, 2020
Splaktar added a commit that referenced this issue Aug 28, 2020
- simplify `$$mdDateUtil.removeLocalTzAndReparseDate()`

Fixes #12000
Splaktar added a commit that referenced this issue Aug 28, 2020
- simplify `$$mdDateUtil.removeLocalTzAndReparseDate()`

Fixes #12000
@Splaktar Splaktar added the has: Pull Request A PR has been created to address this issue label Aug 28, 2020
Splaktar added a commit that referenced this issue Aug 31, 2020
- simplify `$$mdDateUtil.removeLocalTzAndReparseDate()`

Fixes #12000
Splaktar added a commit that referenced this issue Aug 31, 2020
- simplify `$$mdDateUtil.removeLocalTzAndReparseDate()`

Fixes #12000
Splaktar added a commit that referenced this issue Aug 31, 2020
- simplify `$$mdDateUtil.removeLocalTzAndReparseDate()`

Fixes #12000
Splaktar added a commit that referenced this issue Aug 31, 2020
- simplify `$$mdDateUtil.removeLocalTzAndReparseDate()`

Fixes #12000
Splaktar added a commit that referenced this issue Sep 1, 2020
- revert simplification of `$$mdDateUtil.removeLocalTzAndReparseDate()`

Relates to #12000
Splaktar added a commit that referenced this issue Sep 1, 2020
- revert simplification of `$$mdDateUtil.removeLocalTzAndReparseDate()`

Relates to #12000
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has: Pull Request A PR has been created to address this issue i18n: localization This issue is related to internationalization P2: required Issues that must be fixed. resolution: fixed type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant