From 90c476aa0b576b1d7a15cf419b3cc44a8cba0054 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 3 Nov 2022 12:35:11 -0400 Subject: [PATCH] LP1995623 DateTime picker gets min/max date support Signed-off-by: Bill Erickson --- Open-ILS/src/eg2/src/app/share/util/date.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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]) + }; + } } -- 2.11.0