feat(app/utils, plugins): normalize dates with improved format (#573)

This commit is contained in:
Simon Lecoq authored and GitHub committed 2021-10-13 22:08:31 -04:00
1 parent 19036b2e41
commit 662fe8de2f
16 files changed
+32 -16

No files matched your search

+1 -1
View File
@@ -28,7 +28,7 @@ export default async function({login, q, imports, data, computed, graphql, queri
.map(({title, unlock, ...achievement}) => ({
prefix:({S:"Master", A:"Super", B:"Great"}[achievement.rank] ?? ""),
title,
unlock:!/invalid date/i.test(unlock) ? `${imports.format.date(unlock, {timeStyle:"short"})} on ${imports.format.date(unlock, {dateStyle:"short"})}` : null,
unlock:!/invalid date/i.test(unlock) ? `${imports.format.date(unlock, {time:true})} on ${imports.format.date(unlock, {date:true})}` : null,
...achievement,
}))
.map(({icon, ...achievement}) => ({icon:icon.replace(/#primary/g, colors[achievement.rank][0]).replace(/#secondary/g, colors[achievement.rank][1]), ...achievement}))