aboutsummaryrefslogtreecommitdiff
path: root/src/ClientUtils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/ClientUtils.ts')
-rw-r--r--src/ClientUtils.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ClientUtils.ts b/src/ClientUtils.ts
index 51ad55c07..d149c2eae 100644
--- a/src/ClientUtils.ts
+++ b/src/ClientUtils.ts
@@ -651,18 +651,21 @@ 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() };
+ return { startDate: new Date(dateRangeParts[0]), endDate: new Date(dateRangeParts[1]) };
const fromParts = dateRangeParts[0].split('-');
const toParts = dateRangeParts[1].split('-');
const fromYear = parseInt(fromParts[0]);
const fromMonth = parseInt(fromParts[1]) - 1;
- const fromDay = parseInt(fromParts[2]);
+ const fromDay = parseInt(fromParts[2]?.split('T')[0]);
+ const fromHour = parseInt(fromParts[2]?.split('T')[1]?.split(':')[0] || '12');
const toYear = parseInt(toParts[0]);
const toMonth = parseInt(toParts[1]) - 1;
- const toDay = parseInt(toParts[2]);
+ const toDay = parseInt(toParts[2]?.split('T')[0]);
+ const toHour = parseInt(fromParts[2]?.split('T')[1]?.split(':')[0] || '12');
- return { startDate: new Date(fromYear, fromMonth, fromDay), endDate: new Date(toYear, toMonth, toDay) };
+ return { startDate: new Date(fromYear, fromMonth, fromDay, fromHour), endDate: new Date(toYear, toMonth, toDay, toHour) };
}
function replaceCanvases(oldDiv: HTMLElement, newDiv: HTMLElement) {