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

mdDatepicker: Not updated correctly with ng-model-options timezone #9989

Closed
ghost opened this issue Nov 8, 2016 · 6 comments
Closed

mdDatepicker: Not updated correctly with ng-model-options timezone #9989

ghost opened this issue Nov 8, 2016 · 6 comments
Assignees
Labels
i18n: localization This issue is related to internationalization P2: required Issues that must be fixed. resolution: fixed type: bug
Milestone

Comments

@ghost
Copy link

ghost commented Nov 8, 2016

Actual Behavior:

  • What is the issue? * Using md-datetime with ng-model-options="{timezone: '-0500'}", shown value is not updated in accordance with the time zone like Input component.

Not updated correctly
<md-datepicker ng-model="myDate" ng-model-options="{timezone:myDateTimeZone}"></md-datepicker>
Updated correctly
<input type="date" ng-model="myDate" ng-model-options="{timezone:myDateTimeZone}" />

Setting the date using the md-datepicker, the value is set properly.

CodePen (or steps to reproduce the issue): *

Angular Versions: *

  • Angular Version: 1.5.8
  • Angular Material Version: 1.1.0
@topherfangio topherfangio added needs: investigation The cause of this issue is not well understood and needs to be investigated by the team or community P4: minor Minor issues. May not be fixed without community contributions. and removed needs: triage by dev labels Jan 24, 2017
@topherfangio
Copy link
Contributor

I've been playing with this, it looks like we're just not refreshing the model often enough. I'm going to dig into it.

@topherfangio topherfangio added this to the 1.2.0 milestone Jan 24, 2017
@SocVi100
Copy link

@topherfangio I'm also experiencing problems since I updated to 1.1.4. My timezone is UTC+1 but I'm using the datepicker with ng-model-options={ timezone: 'UTC' } because I want to get only the date part (I'm not interested in the time). After closing the picker I get 1 day less than the value I picked...

There's a similar issue here:
#10598 md-datepicker highlights wrong date with timezone and initialized model

@jaybee7
Copy link

jaybee7 commented Jul 24, 2017

Any update on this? I am using Angular 2 and need this to be fixed for production.
md-datepicker shows one day earlier than what is specified.

@Splaktar Splaktar added i18n: localization This issue is related to internationalization P2: required Issues that must be fixed. type: bug needs: more info The issue does not contain enough information for the team to determine if it is a real bug and removed P4: minor Minor issues. May not be fixed without community contributions. labels Jan 5, 2018
@Splaktar
Copy link
Contributor

Splaktar commented Jan 5, 2018

@cristiandonati can you provide a little more detail on how I am supposed to use the CodePen to reproduce the issue? I updated the CodePen for AngularJS Material 1.1.5 and the behavior seems to be the same to me, but I'm not exactly sure how to reproduce the issue based on your description.

I do notice that when changing the date with the input, the time does not change. But when changing the date with the md-datepicker via the panel or input, it resets the time to 12am. This happens with AngularJS Material 1.1.0, but not with 1.1.5.

If that was the issue, then I can close this as fixed, but I am not 100% clear if that was the issue based upon your description and the CodePen.

@Splaktar Splaktar added needs: feedback The issue creator or community need to respond to questions in this issue and removed needs: investigation The cause of this issue is not well understood and needs to be investigated by the team or community labels Jan 5, 2018
@Splaktar Splaktar self-assigned this Jan 5, 2018
@ghost
Copy link
Author

ghost commented Jan 5, 2018

@Splaktar the issue was that the first value shown in the input was calculated based on the UTC time zone and not based on the time zone set in the ngModelOptions.
With 1.1.5 the issue seems solved, but I noticed that the edit dialog has problems.
As you can see in the image, the selected date is calculated with the UTC time zone.

image

@Splaktar
Copy link
Contributor

Splaktar commented Jan 5, 2018

@cristiandonati excellent, thank you. The datepicker currently respects ng-model-options but the calendar, used in the datepicker popup panel, does not. We're tracking that in #10431.

@Splaktar Splaktar closed this as completed Jan 5, 2018
@Splaktar Splaktar modified the milestones: 1.2.0, 1.1.5 Jan 5, 2018
@Splaktar Splaktar added resolution: fixed and removed needs: feedback The issue creator or community need to respond to questions in this issue needs: more info The issue does not contain enough information for the team to determine if it is a real bug labels Jan 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i18n: localization This issue is related to internationalization P2: required Issues that must be fixed. resolution: fixed type: bug
Projects
None yet
Development

No branches or pull requests

5 participants