From 3f41e6d52a690f7294fa0020ca774e62ad285b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Harper?= Date: Wed, 19 May 2021 18:10:17 -0400 Subject: [PATCH] fix date conversion (fix #66) --- src/writer.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/writer.js b/src/writer.js index 7b04f78..0346a0f 100644 --- a/src/writer.js +++ b/src/writer.js @@ -26,7 +26,7 @@ async function processPayloadsPromise(payloads, loadFunc) { } }, payload.delay); })); - + const results = await Promise.allSettled(promises); const failedCount = results.filter(result => result.status === 'rejected').length; if (failedCount === 0) { @@ -157,7 +157,12 @@ async function loadImageFilePromise(imageUrl) { } function getPostPath(post, config) { - const dt = luxon.DateTime.fromISO(post.frontmatter.date); + let dt; + if (settings.custom_date_formatting) { + dt = luxon.DateTime.fromFormat(post.frontmatter.date, settings.custom_date_formatting); + } else { + dt = luxon.DateTime.fromISO(post.frontmatter.date); + } // start with base output dir const pathSegments = [config.output];