Skip to content

Commit

Permalink
Add null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
jalagari committed Apr 17, 2024
1 parent 2e29420 commit 08790f5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion blocks/form/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function days(endDate, startDate) {
const end = typeof endDate === 'string' ? new Date(endDate) : endDate;

// return zero if dates are valid
if (Number.isNaN(start.getTime()) || Number.isNaN(end.getTime())) {
if (!start || !end || Number.isNaN(start.getTime()) || Number.isNaN(end.getTime())) {
return 0;
}

Expand Down

0 comments on commit 08790f5

Please sign in to comment.