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 icsData = await icsRes.text()
|
||||
const data = icsToJson(icsData)
|
||||
const albumReleases = data.filter((d) => DateTime.fromISO(d.startDate) > DateTime.now())
|
||||
return albumReleases.sort((a, b) => new Date(a.startDate) - new Date(b.startDate))
|
||||
const albumReleases = data
|
||||
.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">
|
||||
{% for album in albumReleases %}
|
||||
<li class="mt-1.5 mb-2">
|
||||
<span class="font-bold">{{ album.startDate | readableDate }}: </span>
|
||||
<a href="https://{{album.location}}" title="{{album.summary | escape}}">
|
||||
{{album.summary}}
|
||||
<span class="font-bold">{{ album.date | readableDate }}: </span>
|
||||
<a href="https://{{album.url}}" title="{{album.title | escape}}">
|
||||
{{album.title}}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
|
Reference in a new issue