fix a new site init, unit maybe undefined

This commit is contained in:
tim-hub 2020-09-19 15:11:27 +12:00
parent dadb58b91d
commit 7f22ee3934

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