mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-25 01:13:40 +01:00
ui: Show "now" if the pretty time difference is less than 500ms
This commit is contained in:
parent
e13730f119
commit
8f9eca51c0
@ -2,6 +2,9 @@ export const helper = {
|
|||||||
methods: {
|
methods: {
|
||||||
generatePrettyTimeAgo(t) {
|
generatePrettyTimeAgo(t) {
|
||||||
let differenceInMs = new Date().getTime() - new Date(t).getTime();
|
let differenceInMs = new Date().getTime() - new Date(t).getTime();
|
||||||
|
if (differenceInMs < 500) {
|
||||||
|
return "now";
|
||||||
|
}
|
||||||
if (differenceInMs > 3 * 86400000) { // If it was more than 3 days ago, we'll display the number of days ago
|
if (differenceInMs > 3 * 86400000) { // If it was more than 3 days ago, we'll display the number of days ago
|
||||||
let days = (differenceInMs / 86400000).toFixed(0);
|
let days = (differenceInMs / 86400000).toFixed(0);
|
||||||
return days + " day" + (days !== "1" ? "s" : "") + " ago";
|
return days + " day" + (days !== "1" ? "s" : "") + " ago";
|
||||||
|
Loading…
Reference in New Issue
Block a user