Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

fix(calendar, datepicker): fix issues with GMT+X timezones #12003

Merged
merged 1 commit into from
Aug 31, 2020

Conversation

Splaktar
Copy link
Member

PR Checklist

Please check that your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added or this is not a bug fix / enhancement
  • Docs have been added, updated, or were not required

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Enhancement
[ ] Documentation content changes
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Infrastructure changes
[ ] Other... Please describe:

What is the current behavior?

When local timezone is GMT+X, (i.e. +5:00) using ng-model-options to specify the timezone causes the previous day to be selected.

Issue Number:
Fixes #12000

What is the new behavior?

  • fix issues with GMT+X timezones by avoiding timezone conversions when local timezone is GMT+x. We let the existing utilities for converting dates to midnight handle things since the date doesn't need to change in those cases, just the hours.
  • simplify $$mdDateUtil.removeLocalTzAndReparseDate()

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

We don't have the capability to change the device's timezone between tests.

@Splaktar Splaktar self-assigned this Aug 28, 2020
@googlebot googlebot added the cla: yes PR author has signed Google's CLA: https://opensource.google.com/docs/cla/ label Aug 28, 2020
@Splaktar Splaktar added this to the 1.1.25 milestone Aug 28, 2020
@Splaktar Splaktar added P2: required Issues that must be fixed. type: bug i18n: localization This issue is related to internationalization labels Aug 28, 2020
@Splaktar Splaktar added the pr: merge ready This PR is ready for a caretaker to review label Aug 28, 2020
@Splaktar
Copy link
Member Author

@oliversalzburg is there any chance that you can test the changes in this branch locally to verify the fix in the GMT+2 time zone?

- simplify `$$mdDateUtil.removeLocalTzAndReparseDate()`

Fixes #12000
@Splaktar Splaktar force-pushed the datepicker-fix-gmt+timezone-issues branch from b2398f8 to 6fabe26 Compare August 31, 2020 18:30
@Splaktar Splaktar added the pr: lgtm This PR has been approved by the reviewer label Aug 31, 2020
@Splaktar Splaktar merged commit a897a67 into 1.1.x Aug 31, 2020
@Splaktar Splaktar deleted the datepicker-fix-gmt+timezone-issues branch August 31, 2020 18:44
Splaktar added a commit that referenced this pull request Sep 1, 2020
- revert simplification of `$$mdDateUtil.removeLocalTzAndReparseDate()`

Relates to #12003. Relates to #11949.
Splaktar added a commit that referenced this pull request Sep 1, 2020
- revert simplification of `$$mdDateUtil.removeLocalTzAndReparseDate()`
- enable unit testing of MomentJS
- add test suite for MomentJS custom formatting

Relates to #12003. Relates to #11949.
Splaktar added a commit that referenced this pull request Sep 1, 2020
- revert simplification of `$$mdDateUtil.removeLocalTzAndReparseDate()`
- enable unit testing of MomentJS
- add test suites for MomentJS custom formatting in `dateLocale.spec.js`
  and `datepickerDirective.spec.js`

Relates to #12003. Relates to #11949.
Splaktar added a commit that referenced this pull request Sep 1, 2020
- revert simplification of `$$mdDateUtil.removeLocalTzAndReparseDate()`
- enable unit testing of MomentJS
- add test suites for MomentJS custom formatting in `dateLocale.spec.js`
  and `datepickerDirective.spec.js`

Relates to #12003. Relates to #11949.
Splaktar added a commit that referenced this pull request Sep 1, 2020
- revert simplification of `$$mdDateUtil.removeLocalTzAndReparseDate()`
- enable unit testing of MomentJS
- add test suites for MomentJS custom formatting in `dateLocale.spec.js`
  and `datepickerDirective.spec.js`

Relates to #12003. Relates to #11949.
Splaktar added a commit that referenced this pull request Sep 1, 2020
- revert simplification of `$$mdDateUtil.removeLocalTzAndReparseDate()`
- enable unit testing of MomentJS
- add test suites for MomentJS custom formatting in `dateLocale.spec.js`
  and `datepickerDirective.spec.js`

Relates to #12003. Relates to #11949.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes PR author has signed Google's CLA: https://opensource.google.com/docs/cla/ i18n: localization This issue is related to internationalization P2: required Issues that must be fixed. pr: lgtm This PR has been approved by the reviewer pr: merge ready This PR is ready for a caretaker to review type: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants