chore: normalize and sanitize album release data
This commit is contained in:
parent
99adcac392
commit
1c9e87c6f3
2 changed files with 14 additions and 5 deletions
|
@ -10,6 +10,15 @@ module.exports = async function () {
|
||||||
const icsRes = await fetch(URL)
|
const icsRes = await fetch(URL)
|
||||||
const icsData = await icsRes.text()
|
const icsData = await icsRes.text()
|
||||||
const data = icsToJson(icsData)
|
const data = icsToJson(icsData)
|
||||||
const albumReleases = data.filter((d) => DateTime.fromISO(d.startDate) > DateTime.now())
|
const albumReleases = data
|
||||||
return albumReleases.sort((a, b) => new Date(a.startDate) - new Date(b.startDate))
|
.filter((d) => DateTime.fromISO(d.startDate) > DateTime.now())
|
||||||
|
.sort((a, b) => new Date(a.startDate) - new Date(b.startDate))
|
||||||
|
.map((release) => {
|
||||||
|
return {
|
||||||
|
date: release.startDate,
|
||||||
|
url: release.location,
|
||||||
|
title: release.summary.replace(/\\/g, ''),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return albumReleases
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
<ul class="list-inside list-disc pl-5 md:pl-10">
|
<ul class="list-inside list-disc pl-5 md:pl-10">
|
||||||
{% for album in albumReleases %}
|
{% for album in albumReleases %}
|
||||||
<li class="mt-1.5 mb-2">
|
<li class="mt-1.5 mb-2">
|
||||||
<span class="font-bold">{{ album.startDate | readableDate }}: </span>
|
<span class="font-bold">{{ album.date | readableDate }}: </span>
|
||||||
<a href="https://{{album.location}}" title="{{album.summary | escape}}">
|
<a href="https://{{album.url}}" title="{{album.title | escape}}">
|
||||||
{{album.summary}}
|
{{album.title}}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Reference in a new issue