diff options
| author | bobzel <zzzman@gmail.com> | 2023-12-21 11:58:12 -0500 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2023-12-21 11:58:12 -0500 |
| commit | ee53adac4d718ee5389b66e9b93ab1240565cd30 (patch) | |
| tree | 6f9a3b078b00e7b025c5c257b0fe7028f9df1aa9 /src/Utils.ts | |
| parent | e5536e19be862125cef574faff4d745191d7849c (diff) | |
| parent | f50ed77da0f5bf4990ec8bcd6a3b7b8021081d79 (diff) | |
Merge branch 'zaul-branch-2' into moreUpgrading
Diffstat (limited to 'src/Utils.ts')
| -rw-r--r-- | src/Utils.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Utils.ts b/src/Utils.ts index 5f9475f23..a060e4a2c 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -895,3 +895,24 @@ export function setupMoveUpEvents( document.addEventListener('pointerup', _upEvent, true); document.addEventListener('click', _clickEvent, true); } + +export function dateRangeStrToDates (dateStr: string) { + // dateStr in yyyy-mm-dd format + const dateRangeParts = dateStr.split("|"); // splits into from and to date + 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 toYear = parseInt(toParts[0]); + const toMonth = parseInt(toParts[1])-1; + const toDay = parseInt(toParts[2]); + + + return [ + new Date(fromYear, fromMonth, fromDay), + new Date(toYear, toMonth, toDay) + ]; +}
\ No newline at end of file |
