From 0978aae84571199d6ea333f41a29ec7837789991 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Fri, 29 Sep 2023 10:59:28 +0800 Subject: [PATCH] return empty string if date variable is undefined in the formatDate function --- src/settings/template.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/settings/template.ts b/src/settings/template.ts index a234be1..d4845e5 100644 --- a/src/settings/template.ts +++ b/src/settings/template.ts @@ -120,6 +120,9 @@ function formatDateFunc() { // get the date and format from the text const [dateVariable, format] = text.split(",", 2); const date = render(dateVariable); + if (!date) { + return ""; + } // format the date return formatDate(date, format); };