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

input[type=datetime-local] does not support changing the timezone dynamically #13382

Closed
Dretch opened this issue Nov 25, 2015 · 3 comments · Fixed by #16336
Closed

input[type=datetime-local] does not support changing the timezone dynamically #13382

Dretch opened this issue Nov 25, 2015 · 3 comments · Fixed by #16336

Comments

@Dretch
Copy link

Dretch commented Nov 25, 2015

The timezone can be set on type="datetime-local" inputs (e.g. ng-model-options="{timezone: '+0400'}"), but once the datetime picker has been created, changes to the timezone are not reflected in the edited value.

This plunk demonstrates the issue: http://plnkr.co/edit/R1cFGi23y0Eq2Fe7iN5h?p=preview - when you click the button then the timezone is put forward an hour, but this is not reflected in the time shown.

This happens in at least Chrome and Firefox on OS X, via angular 1.4.7.

@gkalpak
Copy link
Member

gkalpak commented Nov 26, 2015

One problem with tracking the timezone is that it is not clear what should happen when it changes:

  1. modelValue + newTimezone ==> newViewValue ?
  2. viewValue + newTimezone ==> newModelValue ?

@Narretz, any thoughts on this ?

@gkalpak gkalpak added this to the Backlog milestone Nov 26, 2015
@Dretch
Copy link
Author

Dretch commented Nov 26, 2015

@gkalpak

The behaviour I personally would like is for the displayed value to change - the unix timestamp should remain the same.

I was able to work around this issue by forcing a re-render using the directive here http://stackoverflow.com/questions/22080351/how-to-re-render-a-template-in-an-angular-directive

@Narretz
Copy link
Contributor

Narretz commented Nov 26, 2015

ngModelOptions doesn't watch option changes - this is currently by design. We could change that, but so far I haven't seen many requests for it.

For the original options (updateOn, debounce) this wasn't much of a problem, but timezone is a bit of an outlier. We probably shouldn't have put it in there in the first place.

@Narretz Narretz self-assigned this Nov 15, 2017
Narretz added a commit to Narretz/angular.js that referenced this issue Nov 21, 2017
This commit also fixes a bug where part of the Date object
was re-used even after the input was emptied.

Fixes angular#13382
Closes angular#16181
Narretz added a commit to Narretz/angular.js that referenced this issue Nov 21, 2017
This commit also fixes a bug where part of the Date object
was re-used even after the input was emptied.

Fixes angular#16181
Closes angular#13382
Narretz added a commit to Narretz/angular.js that referenced this issue Dec 13, 2017
This commit also fixes a bug where part of the Date object
was re-used even after the input was emptied.

Fixes angular#16181
Closes angular#13382
Narretz added a commit to Narretz/angular.js that referenced this issue Apr 6, 2018
This commit also fixes a bug where part of the Date object
was re-used even after the input was emptied.

Fixes angular#16181
Closes angular#13382
Narretz added a commit that referenced this issue Apr 6, 2018
This commit also fixes a bug where part of the Date object
was re-used even after the input was emptied.

Fixes #16181
Closes #13382
Closes #16336
Narretz added a commit that referenced this issue Apr 6, 2018
This commit also fixes a bug where part of the Date object
was re-used even after the input was emptied.

Fixes #16181
Closes #13382
Closes #16336
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.