DatePicker: timezone

This commit is contained in:
emododu 2017-05-31 13:26:28 +08:00 committed by 杨奕
parent 3b3b3377b5
commit 3284e0a662

View File

@ -32,7 +32,9 @@
const WEEKS = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
const clearHours = function(time) {
const cloneDate = new Date(time);
cloneDate.setHours(0, 0, 0, 0);
const timeZoneOffset = cloneDate.getTimezoneOffset();
const timeZone = timeZoneOffset >= 0 ? 24 - timeZoneOffset / 60 : timeZoneOffset / 60;
cloneDate.setHours(timeZone, 0, 0, 0);
return cloneDate.getTime();
};