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); } }