Fix datepicker DST bug (#2212)

* Fix datepicker DST bug. Closes #2204

This fix is borrowed from:
13885397de (diff-dd513a8bab7ad1033c8784c4a1b9ce15)

* Update NEWS.md
This commit is contained in:
Winston Chang
2018-10-17 15:01:39 -05:00
committed by GitHub
parent fcd09e2bae
commit 0683b79fac
3 changed files with 16 additions and 4 deletions

View File

@@ -47,6 +47,8 @@ This release features plot caching, an important new tool for improving performa
* Fixed [#2142](https://github.com/rstudio/shiny/issues/2142): Dropping files on `fileInput`s stopped working on recent releases of Firefox. Thanks @dmenne for reporting! [#2203](https://github.com/rstudio/shiny/pull/2203)
* Fixed [#2204](https://github.com/rstudio/shiny/issues/2204): `updateDateInput` could set the wrong date on days where DST begins. (Thanks @GaGaMan1101!) [#2212](https://github.com/rstudio/shiny/pull/2212)
### Documentation Updates
* Addressed [#1864](https://github.com/rstudio/shiny/issues/1864) by changing `optgroup` documentation to use `list` instead of `c`. ([#2084](https://github.com/rstudio/shiny/pull/2084))

View File

@@ -529,7 +529,17 @@
},
_utc_to_local: function(utc){
return utc && new Date(utc.getTime() + (utc.getTimezoneOffset()*60000));
if (!utc) return utc;
var local = new Date(utc.getTime() + (utc.getTimezoneOffset() * 60000));
if (local.getTimezoneOffset() != utc.getTimezoneOffset())
{
local = new Date(utc.getTime() + (local.getTimezoneOffset() * 60000));
}
return utc && local;
},
_local_to_utc: function(local){
return local && new Date(local.getTime() - (local.getTimezoneOffset()*60000));

File diff suppressed because one or more lines are too long