This repository has been 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
Labels
needs: investigation
The cause of this issue is not well understood and needs to be investigated by the team or community
type: bug
Date Picker incorrectly works when ng-model-options="{timezone: 'UTC'}" is set.
Issues:
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.
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/
Question in StackOverflow:
https://stackoverflow.com/questions/71123743/angularjs-material-md-datepicker-when-using-ng-model-options-timezone-utc
The text was updated successfully, but these errors were encountered: