Fix date formatiing

This commit is contained in:
Oliver Traber 2023-04-20 21:08:02 +02:00
parent b0a69cda0b
commit 26648b8971
Signed by: Bluemedia
GPG key ID: C0674B105057136C
3 changed files with 12 additions and 2 deletions

View file

@ -24,7 +24,7 @@
<div class="w-full ml-5 flex flex-col">
<p>{{ authenticator.label }}</p>
<p class="text-sm">
{{ $t("webauthn.registered", {date: new Date(authenticator.createdAt).toLocaleString()}) }}
{{ $t("webauthn.registered", {date: moment(authenticator.createdAt)}) }}
</p>
</div>
</div>
@ -45,7 +45,7 @@
</p>
</div>
<div v-if="!webauthnSupported">
<p v-if="!context.auth?.showTryAnotherWayLink" class="mt-5 text-center">
<p v-if="context.auth?.showTryAnotherWayLink" class="mt-5 text-center">
{{ $t("webauthn.noSupportOtherMethod") }}
</p>
<p v-else class="mt-5 text-center">
@ -77,6 +77,7 @@ import ErrorBox from "~/components/ErrorBox.vue";
import type { KcContextBase } from "~/types/context";
import { base64url } from "rfc4648";
import { formPost } from "~/functions/utils";
import moment from "moment";
export default defineComponent({
name: "WebAuthnAuthenticate",
@ -97,6 +98,9 @@ export default defineComponent({
}
},
methods: {
moment(date: string) : string {
return moment(date).toDate().toLocaleString();
},
tryAnotherWay(e: Event) {
e.preventDefault();
formPost(this.context.url.loginAction, {