changed: display

This commit is contained in:
quenousimporte 2024-01-17 21:48:41 +01:00
parent 12b18d5eb2
commit f73f11c282
1 changed files with 16 additions and 3 deletions

19
ics.js
View File

@ -64,16 +64,29 @@ function displayevents(events, func, title)
.filter(func)
.sort( (a,b) => a.DTSTART - b.DTSTART)
.forEach(e => {
var formatteddate = e.DTSTART.toLocaleString('fr-FR', { timeZone: 'Europe/Paris', dateStyle: "full" });
var formatteddate = e.DTSTART.toLocaleString('fr-FR', { timeZone: 'Europe/Paris', dateStyle: "full", timeStyle: "short" });
var splitdate = formatteddate.split(" ");
var year = splitdate[3];
var month = splitdate[2];
group[year] = group[year] || {};
group[year][month] = group[year][month] || [];
group[year][month].push(splitdate[0] + " " + splitdate[1] + ": " + e.SUMMARY);
group[year][month].push(formatteddate + ": " + e.SUMMARY);
});
console.log(title);
console.log(JSON.stringify(group, null, " "));;
for (var year in group)
{
console.log(year);
for (var month in group[year])
{
console.log(" " + month);
group[year][month].forEach(e =>
{
console.log(" " + e);
});
}
}
console.log("");
}
function main()
{