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 Nov 6, 2023
1 parent ecda368 commit 74b2114
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 @@ -123,6 +123,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 74b2114

Please sign in to comment.