From 5c2715f0b04d1f6ca1103c5314b69ea58240639b Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Tue, 20 Feb 2024 12:59:07 +0100 Subject: [PATCH] Fix filenames --- script/crawl.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/script/crawl.js b/script/crawl.js index 3682faf..61d9298 100644 --- a/script/crawl.js +++ b/script/crawl.js @@ -28,9 +28,13 @@ let slice = 0 const size = 20 const now = new Date() const destination = new URL( - `../data/${now.getUTCFullYear()}-${ - now.getUTCMonth() + 1 - }-${now.getUTCDate()}.json`, + '../data/' + + String(now.getUTCFullYear()).padStart(4, '0') + + '-' + + String(now.getUTCMonth() + 1).padStart(2, '0') + + '-' + + String(now.getUTCDate()).padStart(2, '0') + + '.json', import.meta.url )