Skip to content

Commit

Permalink
Fixed fractional seconds on admin page
Browse files Browse the repository at this point in the history
  • Loading branch information
hudson-newey committed Dec 19, 2023
1 parent f1532c8 commit 1716a70
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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;
Expand All @@ -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);
}
}

Expand Down

0 comments on commit 1716a70

Please sign in to comment.