From 7f22ee3934aa0271cdf3cb980f9dc8e95ae58e6e Mon Sep 17 00:00:00 2001 From: tim-hub Date: Sat, 19 Sep 2020 15:11:27 +1200 Subject: [PATCH] fix a new site init, unit maybe undefined --- lib/date.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/date.js b/lib/date.js index 63bad45e..da071128 100644 --- a/lib/date.js +++ b/lib/date.js @@ -136,6 +136,10 @@ export function getDateArray(data, startDate, endDate, unit) { } export function getDateLength(startDate, endDate, unit) { + if (!unit) { + unit = 'day'; + } + const [diff] = dateFuncs[unit]; return diff(endDate, startDate) + 1; }