Show "Never" when a user never logged in instead of a date (#335)

This commit is contained in:
Eduard Gert
2024-02-16 12:15:32 +01:00
committed by GitHub
parent bca327e4cf
commit a04e3afccb

View File

@@ -252,6 +252,9 @@ function UserOverview({ user }: Props) {
function UserInformationCard({ user }: { user: User }) {
const isServiceUser = user.is_service_user || false;
const neverLoggedIn = dayjs(user.last_login).isBefore(
dayjs().subtract(1000, "years"),
);
return (
<Card>
@@ -307,10 +310,12 @@ function UserInformationCard({ user }: { user: User }) {
</>
}
value={
dayjs(user.last_login).format("D MMMM, YYYY [at] h:mm A") +
" (" +
dayjs().to(user.last_login) +
")"
neverLoggedIn
? "Never"
: dayjs(user.last_login).format("D MMMM, YYYY [at] h:mm A") +
" (" +
dayjs().to(user.last_login) +
")"
}
/>
</>