frontend use exact time in every case

This commit is contained in:
Ruben Fiszel
2022-10-02 02:56:01 +02:00
parent 945a750c6b
commit 6f767abec1
2 changed files with 6 additions and 5 deletions
@@ -114,7 +114,7 @@
</div>
</div>
<div class="bg-white grid grid-cols-2 gap-x-2 col-span-2">
<div class="w-full text-gray-500 text-xs text-left flex flex-col gap-1 mx-4">
<div class="w-full text-gray-500 text-xs text-left flex flex-col gap-1 mx-4 overflow-hidden">
<div>
<Icon class="text-gray-700" data={faUser} scale={SMALL_ICON_SCALE} /><span class="mx-2">
By {job.created_by}</span
+5 -4
View File
@@ -43,8 +43,10 @@ export function displayDaysAgo(dateString: string): string {
let dAgo = daysAgo(date)
if (dAgo == 0) {
return `yday at ${date.toLocaleTimeString()}`
} else if (dAgo > 7) {
return `${dAgo + 1} days ago at ${date.toLocaleTimeString()}`
} else {
return `${dAgo + 1} days ago`
return displayDate(dateString)
}
}
}
@@ -54,9 +56,8 @@ export function displayDate(dateString: string | undefined): string {
if (date.toString() === 'Invalid Date') {
return ''
} else {
return `${date.getFullYear()}/${
date.getMonth() + 1
}/${date.getDate()} at ${date.toLocaleTimeString()}`
return `${date.getFullYear()}/${date.getMonth() + 1
}/${date.getDate()} at ${date.toLocaleTimeString()}`
}
}