diff --git a/package.json b/package.json index 1167101..ed285a0 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "webpack-cli": "^4.9.1" }, "dependencies": { + "moment": "^2.29.4", "rfc4648": "^1.5.2", "vue": "^3.2.26", "vue-i18n": "9" diff --git a/src/views/webauthn-authenticate/index.vue b/src/views/webauthn-authenticate/index.vue index ea42111..e366d6f 100644 --- a/src/views/webauthn-authenticate/index.vue +++ b/src/views/webauthn-authenticate/index.vue @@ -24,7 +24,7 @@

{{ authenticator.label }}

- {{ $t("webauthn.registered", {date: new Date(authenticator.createdAt).toLocaleString()}) }} + {{ $t("webauthn.registered", {date: moment(authenticator.createdAt)}) }}

@@ -45,7 +45,7 @@

-

+

{{ $t("webauthn.noSupportOtherMethod") }}

@@ -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, { diff --git a/yarn.lock b/yarn.lock index 672bad5..8d90603 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3304,6 +3304,11 @@ minimist@^1.2.0, minimist@^1.2.6: resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" 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: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"