upate-badge: handle failed moments

This commit is contained in:
Bogdan Popa committed 2022-12-01 20:00:04 +02:00
1 parent f13321498c
commit 77542a0531
1 file changed
+4
+4
View File
@@ -80,6 +80,10 @@ function colorScale(steps, colors, reversed) {
}
function age(date) {
if (!date.add) {
return "red"
}
const now = moment()
const then = moment(date)
if (now.diff(date) < 0) date.add(-1, 'y')