diff --git a/web/src/pages/stages/invitation/InvitationForm.ts b/web/src/pages/stages/invitation/InvitationForm.ts index 91708c770..635be3687 100644 --- a/web/src/pages/stages/invitation/InvitationForm.ts +++ b/web/src/pages/stages/invitation/InvitationForm.ts @@ -6,7 +6,7 @@ import { DEFAULT_CONFIG } from "../../../api/Config"; import "../../../elements/forms/HorizontalFormElement"; import "../../../elements/CodeMirror"; import YAML from "yaml"; -import { first } from "../../../utils"; +import { dateTimeLocal, first } from "../../../utils"; import { ModelForm } from "../../../elements/forms/ModelForm"; @customElement("ak-invitation-form") @@ -41,7 +41,12 @@ export class InvitationForm extends ModelForm { renderForm(): TemplateResult { return html`
- + { diff --git a/web/src/utils.ts b/web/src/utils.ts index ca781ca6c..1993f5267 100644 --- a/web/src/utils.ts +++ b/web/src/utils.ts @@ -87,3 +87,13 @@ export function randomString(len: number): string { window.crypto.getRandomValues(arr); return hexEncode(arr); } + +export function dateTimeLocal(date: Date): string { + // So for some reason, the datetime-local input field requires ISO Datetime as value + // But the standard javascript date.toISOString() returns everything with seconds and + // milliseconds, which the input field doesn't like (on chrome, on firefox its fine) + // On chrome, setting .valueAsNumber works, but that causes an error on firefox, so go + // figure. + const parts = date.toISOString().split(":"); + return `${parts[0]}:${parts[1]}`; +}