Skip to content

Commit

Permalink
return empty string if date variable is undefined in the formatDate f…
Browse files Browse the repository at this point in the history
…unction
  • Loading branch information
sywhb committed Sep 29, 2023
1 parent 0a18943 commit 0978aae
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/settings/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down

0 comments on commit 0978aae

Please sign in to comment.