diff options
author | bobzel <zzzman@gmail.com> | 2024-09-04 17:48:13 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2024-09-04 17:48:13 -0400 |
commit | df5217eea01b6ee3ce03ceede030306d05f19c58 (patch) | |
tree | bc78c59a43055c162a81016d59b9f725169c29fe /src/ClientUtils.ts | |
parent | c674b67913ecfae6f99749db411d39f8f0d5b164 (diff) |
updated calendars to support times of events and to render evdnts at the correct time.
Diffstat (limited to 'src/ClientUtils.ts')
-rw-r--r-- | src/ClientUtils.ts | 9 |
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) { |