mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Merge pull request #2071 from chamakura/develop
Fixing double conversion of time between UTC and local timezone
This commit is contained in:
commit
862bf78e63
@ -468,11 +468,6 @@ Module.register("calendar", {
|
|||||||
for (var e in calendar) {
|
for (var e in calendar) {
|
||||||
var event = JSON.parse(JSON.stringify(calendar[e])); // clone object
|
var event = JSON.parse(JSON.stringify(calendar[e])); // clone object
|
||||||
|
|
||||||
// correct data for the current timezone
|
|
||||||
var offset = -(new Date().getTimezoneOffset() * 60 * 1000);
|
|
||||||
event.startDate = event.startDate - offset;
|
|
||||||
event.endDate = event.endDate - offset;
|
|
||||||
|
|
||||||
if (event.endDate < now) {
|
if (event.endDate < now) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -186,10 +186,7 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumNu
|
|||||||
// kblankenship1989 - to fix issue #1798, converting all dates to locale time first, then converting back to UTC time
|
// kblankenship1989 - to fix issue #1798, converting all dates to locale time first, then converting back to UTC time
|
||||||
const pastLocal = pastMoment.subtract(past.getTimezoneOffset(), "minutes").toDate();
|
const pastLocal = pastMoment.subtract(past.getTimezoneOffset(), "minutes").toDate();
|
||||||
const futureLocal = futureMoment.subtract(future.getTimezoneOffset(), "minutes").toDate();
|
const futureLocal = futureMoment.subtract(future.getTimezoneOffset(), "minutes").toDate();
|
||||||
const datesLocal = rule.between(pastLocal, futureLocal, true, limitFunction);
|
const dates = rule.between(pastLocal, futureLocal, true, limitFunction);
|
||||||
const dates = datesLocal.map(function (dateLocal) {
|
|
||||||
return moment(dateLocal).add(dateLocal.getTimezoneOffset(), "minutes").toDate();
|
|
||||||
});
|
|
||||||
|
|
||||||
// The "dates" array contains the set of dates within our desired date range range that are valid
|
// The "dates" array contains the set of dates within our desired date range range that are valid
|
||||||
// for the recurrence rule. *However*, it's possible for us to have a specific recurrence that
|
// for the recurrence rule. *However*, it's possible for us to have a specific recurrence that
|
||||||
|
Loading…
x
Reference in New Issue
Block a user