Skip to content

Commit

Permalink
Show "Never" when a user never logged in instead of a date (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
heisbrot authored Feb 16, 2024
1 parent bca327e commit a04e3af
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/app/(dashboard)/team/user/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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) +
")"
}
/>
</>
Expand Down

0 comments on commit a04e3af

Please sign in to comment.