mirror of https://github.com/espruino/BangleApps
sched/calendar interface: fix null timezone
parent
e513b90bf4
commit
c815168bda
|
@ -32,12 +32,14 @@ function readFile(input) {
|
|||
const jCalData = ICAL.parse(icalText);
|
||||
const comp = new ICAL.Component(jCalData);
|
||||
const vtz = comp.getFirstSubcomponent('vtimezone');
|
||||
const tz = new ICAL.Timezone(vtz);
|
||||
const tz = vtz != null ? new ICAL.Timezone(vtz) : null;
|
||||
|
||||
// Fetch the VEVENT part
|
||||
comp.getAllSubcomponents('vevent').forEach(vevent => {
|
||||
const event = new ICAL.Event(vevent);
|
||||
if (tz != null) {
|
||||
event.startDate.zone = tz;
|
||||
}
|
||||
holidays = holidays.filter(holiday => !sameDay(new Date(holiday.date), event.startDate.toJSDate())); // remove if already exists
|
||||
|
||||
const holiday = eventToHoliday(event);
|
||||
|
|
|
@ -20,7 +20,7 @@ function readFile(input) {
|
|||
const jCalData = ICAL.parse(icalText);
|
||||
const comp = new ICAL.Component(jCalData);
|
||||
const vtz = comp.getFirstSubcomponent('vtimezone');
|
||||
const tz = new ICAL.Timezone(vtz);
|
||||
const tz = vtz != null ? new ICAL.Timezone(vtz) : null;
|
||||
|
||||
// Fetch the VEVENT part
|
||||
comp.getAllSubcomponents('vevent').forEach(vevent => {
|
||||
|
@ -73,7 +73,9 @@ function getAlarmDefaults() {
|
|||
}
|
||||
|
||||
function eventToAlarm(event, tz, offsetMs) {
|
||||
if (tz != null) {
|
||||
event.startDate.zone = tz;
|
||||
}
|
||||
const dateOrig = event.startDate.toJSDate();
|
||||
const date = offsetMs ? new Date(dateOrig - offsetMs) : dateOrig;
|
||||
|
||||
|
|
Loading…
Reference in New Issue