aboutsummaryrefslogtreecommitdiff
path: root/src/ClientUtils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/ClientUtils.ts')
-rw-r--r--src/ClientUtils.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ClientUtils.ts b/src/ClientUtils.ts
index 55801df81..51ad55c07 100644
--- a/src/ClientUtils.ts
+++ b/src/ClientUtils.ts
@@ -650,6 +650,7 @@ export function DivWidth(ele: HTMLElement | null): number {
export function dateRangeStrToDates(dateStr: string) {
// dateStr in yyyy-mm-dd format
const dateRangeParts = dateStr.split('|'); // splits into from and to date
+ if (dateRangeParts.length < 2) return { startDate: new Date(), endDate: new Date() };
const fromParts = dateRangeParts[0].split('-');
const toParts = dateRangeParts[1].split('-');
@@ -661,7 +662,7 @@ export function dateRangeStrToDates(dateStr: string) {
const toMonth = parseInt(toParts[1]) - 1;
const toDay = parseInt(toParts[2]);
- return [new Date(fromYear, fromMonth, fromDay), new Date(toYear, toMonth, toDay)];
+ return { startDate: new Date(fromYear, fromMonth, fromDay), endDate: new Date(toYear, toMonth, toDay) };
}
function replaceCanvases(oldDiv: HTMLElement, newDiv: HTMLElement) {