Add 'Fix datepicker DST bug' as patch

- Original commit: 0683b79
This commit is contained in:
Alan Dipert
2019-03-26 17:44:38 -07:00
parent 8ca3397c5d
commit 4cd92a1cd9

View File

@@ -0,0 +1,23 @@
diff --git a/inst/www/shared/datepicker/js/bootstrap-datepicker.js b/inst/www/shared/datepicker/js/bootstrap-datepicker.js
index 76a99fc2..97f5c086 100644
--- a/inst/www/shared/datepicker/js/bootstrap-datepicker.js
+++ b/inst/www/shared/datepicker/js/bootstrap-datepicker.js
@@ -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));