From 1716a708e17677a62c0e488fd7d26c0130a7451e Mon Sep 17 00:00:00 2001 From: hudson-newey Date: Tue, 19 Dec 2023 11:45:50 +1000 Subject: [PATCH] Fixed fractional seconds on admin page --- .../admin/datetime-templates/datetime-templates.component.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/components/admin/datetime-templates/datetime-templates.component.ts b/src/app/components/admin/datetime-templates/datetime-templates.component.ts index 100a13e0b..060fd1fea 100644 --- a/src/app/components/admin/datetime-templates/datetime-templates.component.ts +++ b/src/app/components/admin/datetime-templates/datetime-templates.component.ts @@ -18,6 +18,7 @@ class DateTimeExampleComponent extends PageComponent { protected fakeSiteTimezone = "Australia/Perth"; protected fakeDate = DateTime.now(); protected fakeDuration = Duration.fromObject({ hours: 1, minutes: 30 }); + private dateTimeFormat = "yyyy-MM-dd HH:mm:ss.SSS"; protected get fakeDateWithZone(): DateTime { const luxonDateTime = @@ -39,7 +40,7 @@ class DateTimeExampleComponent extends PageComponent { protected updateFakeDate(event): void { const inputValue: string = event.target.value; - const newDate = DateTime.fromFormat(inputValue, "yyyy-MM-dd HH:mm:ss"); + const newDate = DateTime.fromFormat(inputValue, this.dateTimeFormat); if (newDate.isValid) { this.fakeDate = newDate; @@ -48,7 +49,7 @@ class DateTimeExampleComponent extends PageComponent { // used in the date/time input protected formatDate(dateTime: DateTime): string { - return dateTime.toFormat("yyyy-MM-dd HH:mm:ss"); + return dateTime.toFormat(this.dateTimeFormat); } }