Skip to content
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.

datepicker: works incorrectly when ng-model-options="{timezone: 'UTC'}" is set #12149

Open
@vdrasutis

Description

@vdrasutis

Date Picker incorrectly works when ng-model-options="{timezone: 'UTC'}" is set.

Issues:

  1. When initial date loaded local date is displayed in calendar and input shows correctly UTC date.
    How to reproduce: Goto "Demo 1" and you will see the issue. ( my time zone is +02:00). So I set initial date to be Today and setting UTC time to 23 hours. So first time when date picker is loaded input box will show local time (incorrectly) and date picker will show date in UTC (correctly). images in the Stack Overflow link. Main point to repeat this bug to set time in UTC smalled than timezone offset difference. I.E. I set 23h in UTC, so as my timezone is +2h, then in local time would be next day 01:00h. And input box will show local time.

  2. When selecting same date few times - input box and calendar date is out of sync (in calendar local date is displayed - should be UTC)
    How to reproduce: Go to demo page. Then select date i.e. 2020-02-18th in date picker, then again open date picker and select same ("2020-02-18th") date after selection open again date picker and you will see that in date picker "2020-02-17th" day is selected. This also can be reproduced on official page sample "Ng Model Options Timezone" when few times selecting same date in date picker (demo: https://codepen.io/laurencijus/pen/mdqXRMe).

** Demo 1**: https://codepen.io/Drasius/pen/dyZdvoM (can reproduce booth issues)
Demo 2: https://jsfiddle.net/Drasius/z51vgqr6/27/

  • My time zone: UTC/GMT +2 hours (Lithuania, Vilnius)
  • AngularJS: 1.8.2
  • AngularJS Material: 1.2.4
  • OS: Windows
  • Browsers: Chrome

Question in StackOverflow:
https://stackoverflow.com/questions/71123743/angularjs-material-md-datepicker-when-using-ng-model-options-timezone-utc

Metadata

Metadata

Assignees

Labels

needs: investigationThe cause of this issue is not well understood and needs to be investigated by the team or communitytype: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions