From b03c4819262d1f65559ac7e389930297484b2979 Mon Sep 17 00:00:00 2001 From: ana Date: Sun, 8 Aug 2021 19:00:00 +0200 Subject: fix: correctly display expiration dates --- src/App.svelte | 5 +++-- src/bestiary.js | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/App.svelte b/src/App.svelte index c3471f1..1241d9f 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -5,6 +5,7 @@ import { getMatches } from "./bestiary"; import day from "dayjs"; import relativeTime from "dayjs/plugin/relativeTime"; + import { isNumber } from "util"; day.extend(relativeTime); let date = new Date().getTime() * (1440 / 70); @@ -95,7 +96,7 @@ return f; }); - if (i) { + if (typeof i === "number") { return `in ${day(getZoneForecast()[i + 1].date).fromNow()}`; } return "in the far future"; @@ -108,7 +109,7 @@ return !f; }); - if (i) { + if (typeof i === "number") { return `for another ${day(getZoneForecast()[i + 1].date).fromNow(true)}`; } diff --git a/src/bestiary.js b/src/bestiary.js index b09a613..f4a6937 100644 --- a/src/bestiary.js +++ b/src/bestiary.js @@ -32,6 +32,7 @@ export function getMatches(forecast, level) { }); } }); + console.log(res); return res; } -- cgit 1.4.1-2-gfad0