aboutsummaryrefslogtreecommitdiff
path: root/src/ClientUtils.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-09-04 13:05:17 -0400
committerbobzel <zzzman@gmail.com>2024-09-04 13:05:17 -0400
commit0b77229000231869695a6211e216d5b1755f53f7 (patch)
tree70bc7018a861c07a93cb855ce6ac55d449991ee8 /src/ClientUtils.ts
parent158d501642b0183b286913eb396c396922166435 (diff)
made calendarBox work
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) {