fix user info sidebar last access timestamp (#12047)

This commit is contained in:
Azri Kahar
2022-03-10 03:34:21 +08:00
committed by GitHub
parent bf827629ef
commit 5101b3409f

View File

@@ -57,13 +57,16 @@ export default defineComponent({
const lastAccessDate = ref('');
watch(
() => props,
[() => props.user, () => props.isNew],
async () => {
if (!props.user) return;
lastAccessDate.value = await localizedFormat(
new Date(props.user.last_access),
String(t('date-fns_date_short'))
);
if (props.user.last_access) {
lastAccessDate.value = await localizedFormat(
new Date(props.user.last_access),
String(t('date-fns_date_short'))
);
}
},
{ immediate: true }
);