From: Bill Erickson Date: Thu, 3 Nov 2022 16:35:11 +0000 (-0400) Subject: LP1995623 DateTime picker gets min/max date support X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=90c476aa0b576b1d7a15cf419b3cc44a8cba0054;p=working%2FEvergreen.git LP1995623 DateTime picker gets min/max date support Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/share/util/date.ts b/Open-ILS/src/eg2/src/app/share/util/date.ts index bca15963f3..681ba1883f 100644 --- a/Open-ILS/src/eg2/src/app/share/util/date.ts +++ b/Open-ILS/src/eg2/src/app/share/util/date.ts @@ -1,6 +1,12 @@ /* Utility code for dates */ +export interface YmdParts { + year: number; + month: number; + day: number; +} + export class DateUtil { /** @@ -66,5 +72,15 @@ export class DateUtil { ((now.getMonth() + 1) + '').padStart(2, '0') + '-' + (now.getDate() + '').padStart(2, '0'); } + + static localYmdPartsFromDate(date?: Date): YmdParts { + const ymd = DateUtil.localYmdFromDate(date); + const parts = ymd.split(/-/); + return { + year: Number(parts[0]), + month: Number(parts[1]), + day: Number(parts[2]) + }; + } }