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

@ -45,6 +45,7 @@
"webpack-cli": "^4.9.1" "webpack-cli": "^4.9.1"
}, },
"dependencies": { "dependencies": {
"moment": "^2.29.4",
"rfc4648": "^1.5.2", "rfc4648": "^1.5.2",
"vue": "^3.2.26", "vue": "^3.2.26",
"vue-i18n": "9" "vue-i18n": "9"

View file

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

View file

@ -3304,6 +3304,11 @@ minimist@^1.2.0, minimist@^1.2.6:
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
moment@^2.29.4:
version "2.29.4"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108"
integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==
ms@2.1.2: ms@2.1.2:
version "2.1.2" version "2.1.2"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"