fix a new site init, unit maybe undefined

pull/182/head
tim-hub 2020-09-19 15:11:27 +12:00
parent dadb58b91d
commit 7f22ee3934
1 changed files with 4 additions and 0 deletions

View File

@ -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;
}