diff --git a/src/index.tsx b/src/index.tsx index c8e297b..7d3bba4 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -57,16 +57,17 @@ const server = serve({ allEvents = allEvents.concat(...events.data); } const noGeo = !events.geo.lat && !events.geo.lng; - const geo = noGeo ? {} : { lat: events.geo.lat, lon: events.geo.lng }; - const configs: ics.EventAttributes[] = allEvents?.filter(e => !e.isFinished)?.map(e => ({ - ...geo, + const geo = { lat: events.geo.lat, lon: events.geo.lng }; + + const configs: ics.EventAttributes[] = allEvents.filter(e => !e.isFinished).map(e => ({ + ...(noGeo ? {} : { geo }), start: dayjs.tz(e.startDate, 'Asia/Tokyo').format('YYYY-MM-DD-HH-mm').split('-').map(v => Number(v)) as any, duration: { hours: 6, minutes: 30 }, title: e.title, // end: dayjs(event.startDate).add(6, 'h').add(30, 'minute').format('YYYY-MM-DD HH:mm'), // description: 'Annual 10-kilometer run in Boulder, Colorado', - location: e.location, // url: e.url, + ...(e.location ? { location: e.location } : {}), // geo: { lat: events.location.lat, lon: events.location.lng }, alarms: [ { action: 'display', summary: e.title, description: '距离比赛开始还有 2 小时', trigger: { before: true, hours: 2 } },