From 40b1529f11952b23bee2f7dbd039b8fe3f6c6204 Mon Sep 17 00:00:00 2001 From: jakeaturner Date: Mon, 17 Jun 2024 15:49:21 -0700 Subject: [PATCH] fix(LibreOne): fix last_access parsing --- .../controlpanel/CentralIdentity/ManageUserModal.tsx | 11 ++++++++++- client/src/types/CentralIdentity.ts | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/client/src/components/controlpanel/CentralIdentity/ManageUserModal.tsx b/client/src/components/controlpanel/CentralIdentity/ManageUserModal.tsx index 5a8b0555..d1a90353 100644 --- a/client/src/components/controlpanel/CentralIdentity/ManageUserModal.tsx +++ b/client/src/components/controlpanel/CentralIdentity/ManageUserModal.tsx @@ -30,6 +30,7 @@ import useGlobalError from "../../error/ErrorHooks"; import { copyToClipboard, dirtyValues } from "../../../utils/misc"; import LoadingSpinner from "../../LoadingSpinner"; import { CentralIdentityApp } from "../../../types/CentralIdentity"; +import { format, parseISO } from "date-fns"; const AddUserAppModal = lazy(() => import("./AddUserAppModal")); const AddUserOrgModal = lazy(() => import("./AddUserOrgModal")); const ConfirmRemoveOrgOrAppModal = lazy( @@ -91,6 +92,8 @@ const ManageUserModal: React.FC = ({ user_type: "student", student_id: "", avatar: DEFAULT_AVATAR_URL, + last_access: "", + last_password_change: "", }, }); @@ -556,7 +559,13 @@ const ManageUserModal: React.FC = ({

- Time of Last Access: Unknown + Time of Last Access: + {getValues("last_access") + ? format( + parseISO(getValues("last_access") as string), + "MM/dd/yyyy hh:mm aa" + ) + : "Unknown"}

diff --git a/client/src/types/CentralIdentity.ts b/client/src/types/CentralIdentity.ts index 7f6c682c..c15f3daa 100644 --- a/client/src/types/CentralIdentity.ts +++ b/client/src/types/CentralIdentity.ts @@ -50,6 +50,7 @@ export type CentralIdentityUser = { first_name: string; last_name: string; last_password_change: string | null; + last_access?: string | null; legacy: boolean; organizations: CentralIdentityOrg[]; registration_complete: boolean | null;