From 0f115971c6c2b67450ede6bd07f055dff8149ff3 Mon Sep 17 00:00:00 2001 From: Bauke Date: Wed, 11 Nov 2020 18:47:21 +0100 Subject: [PATCH] Fix dates not being initialized when retrieved from storage. --- source/utilities/settings.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/utilities/settings.ts b/source/utilities/settings.ts index 4d356d9..044b185 100644 --- a/source/utilities/settings.ts +++ b/source/utilities/settings.ts @@ -23,9 +23,17 @@ const defaultSettings: Settings = { */ export async function getSettings(): Promise { const syncSettings: any = await browser.storage.sync.get(defaultSettings); + + const queue: QItem[] = syncSettings.queue; + + // Initialize all the non-JSON values, as they are stringified when saved. + for (const item of queue) { + item.added = new Date(item.added); + } + const settings: Settings = { latestVersion: syncSettings.latestVersion, - queue: syncSettings.queue + queue }; return settings;