From 17fb18763a433762bc91e6c0c6d155411ebf5d2a Mon Sep 17 00:00:00 2001 From: Made Baruna Date: Wed, 19 May 2021 14:16:52 +0800 Subject: [PATCH] Forgot to convert the time --- src/routes/wish/_counter.svelte | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/routes/wish/_counter.svelte b/src/routes/wish/_counter.svelte index 5658ca33..d769c47e 100644 --- a/src/routes/wish/_counter.svelte +++ b/src/routes/wish/_counter.svelte @@ -175,6 +175,14 @@ isEdit = false; } + function convertTime(data) { + for (const pull of data.pulls) { + pull.time = dayjs.unix(pull.time).format('YYYY-MM-DD HH:mm:ss'); + } + + return data; + } + export async function readLocalData() { console.log('wish read local'); const prefix = getAccountPrefix(); @@ -183,8 +191,8 @@ if (data !== null) { let counterData = data; if (typeof data === 'string') { - counterData = JSON.parse(data); - await updateSave(`${prefix}${path}`, JSON.parse(data), true); + const converted = convertTime(JSON.parse(data)); + await updateSave(`${prefix}${path}`, converted, true); } total = counterData.total;