Skip to content

Commit a04e3af

Browse files
authored
Show "Never" when a user never logged in instead of a date (#335)
1 parent bca327e commit a04e3af

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/app/(dashboard)/team/user/page.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,9 @@ function UserOverview({ user }: Props) {
252252

253253
function UserInformationCard({ user }: { user: User }) {
254254
const isServiceUser = user.is_service_user || false;
255+
const neverLoggedIn = dayjs(user.last_login).isBefore(
256+
dayjs().subtract(1000, "years"),
257+
);
255258

256259
return (
257260
<Card>
@@ -307,10 +310,12 @@ function UserInformationCard({ user }: { user: User }) {
307310
</>
308311
}
309312
value={
310-
dayjs(user.last_login).format("D MMMM, YYYY [at] h:mm A") +
311-
" (" +
312-
dayjs().to(user.last_login) +
313-
")"
313+
neverLoggedIn
314+
? "Never"
315+
: dayjs(user.last_login).format("D MMMM, YYYY [at] h:mm A") +
316+
" (" +
317+
dayjs().to(user.last_login) +
318+
")"
314319
}
315320
/>
316321
</>

0 commit comments

Comments
 (0)