You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function updateCalendar() {
ical.fromURL(eventsFeed, {}, function (err, data) {
for (let k in data) {
if (data.hasOwnProperty(k)) {
var ev = data[k];
if (data[k].type == 'VEVENT') {
if (dateNow < ev.start) {
let tts = `On <say-as interpret-as="date" format="ymd">${ev.start.toISOString().slice(0,10)}</say-as> at ${ev.start.toLocaleTimeString('en-GB')}: ${ev.summary}. ${ev.description}`;
console.log(tts);
}
}
}
}
});
}
I get this output:
On <say-as interpret-as="date" format="ymd">2018-10-13</say-as> at 1:00:00 PM: KAB Autumn Social. Save the Date - More details will follow
On <say-as interpret-as="date" format="ymd">2018-09-06</say-as> at 12:00:00 AM: Eye Contact Trip to Coast. For more information contact Anne Bleckwen
On <say-as interpret-as="date" format="ymd">2018-08-08</say-as> at 12:30:00 PM: Lawn Bowls Friendly - Metro Blind Bowls. Pick Up from Kingston Police station 12.30pm
On <say-as interpret-as="date" format="ymd">2018-09-15</say-as> at 9:00:00 AM: Surbiton Farmers Market.
Which is clearly in the wrong order, but for some reason, Google has the dates in random order in the ical output. I've temporarily worked around it with the following code:
function updateCalendar() {
ical.fromURL(eventsFeed, {}, function (err, data) {
var ttsorted = [];
for (let k in data) {
if (data.hasOwnProperty(k)) {
var ev = data[k];
if (data[k].type == 'VEVENT') {
if (dateNow < ev.start) {
let tts = `On <say-as interpret-as="date" format="ymd">${ev.start.toISOString().slice(0,10)}</say-as> at ${ev.start.toLocaleTimeString('en-GB')}: ${ev.summary}. ${ev.description}`;
ttsorted.push(tts);
}
}
}
}
console.log(ttsorted.sort());
});
}
which gives me this.
'On <say-as interpret-as="date" format="ymd">2018-08-08</say-as> at 12:30:00 PM: Lawn Bowls Friendly - Metro Blind Bowls. Pick Up from Kingston Police station 12.30pm',
'On <say-as interpret-as="date" format="ymd">2018-09-06</say-as> at 12:00:00 AM: Eye Contact Trip to Coast. For more information contact Anne Bleckwen',
'On <say-as interpret-as="date" format="ymd">2018-09-15</say-as> at 9:00:00 AM: Surbiton Farmers Market. ',
'On <say-as interpret-as="date" format="ymd">2018-10-13</say-as> at 1:00:00 PM: KAB Autumn Social. Save the Date - More details will follow'
It works, but it would be nice to have a built-in "sort-by-date"
The text was updated successfully, but these errors were encountered:
With the URL:
https://calendar.google.com/calendar/ical/kingstonassoc%40gmail.com/public/basic.ics
And the following code:
I get this output:
Which is clearly in the wrong order, but for some reason, Google has the dates in random order in the ical output. I've temporarily worked around it with the following code:
which gives me this.
It works, but it would be nice to have a built-in "sort-by-date"
The text was updated successfully, but these errors were encountered: