aboutsummaryrefslogtreecommitdiff
path: root/assets/js
diff options
context:
space:
mode:
Diffstat (limited to 'assets/js')
-rw-r--r--assets/js/index.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/assets/js/index.js b/assets/js/index.js
index 72e6736..4ae6d7c 100644
--- a/assets/js/index.js
+++ b/assets/js/index.js
@@ -566,10 +566,10 @@
try {
const time = new Date(element.dateTime) || new Date();
const interval = (new Date().getTime() - time.getTime()) / 1000;
- const seconds = Math.floor(interval);
- const minutes = Math.floor(seconds / 60);
- const hours = Math.floor(minutes / 60);
- const days = Math.floor(hours / 24);
+ const seconds = Math.round(interval);
+ const minutes = Math.round(seconds / 60);
+ const hours = Math.round(minutes / 60);
+ const days = Math.round(hours / 24);
const past = Math.sign(seconds) === 1;
const future = Math.sign(seconds) === -1;
if (past) {
@@ -582,21 +582,21 @@
if (hours <= 48) {
return element.textContent = relative.format(-1 * hours, "hour");
}
- if (days <= 60) {
+ if (days <= 7) {
return element.textContent = relative.format(-1 * days, "day");
}
}
if (future) {
- if (-1 * days >= 60) {
+ if (-1 * days >= 4) {
return element.textContent = relative.format(-1 * days, "day");
}
- if (-1 * hours >= 48) {
+ if (-1 * hours >= 3) {
return element.textContent = relative.format(-1 * hours, "hour");
}
- if (-1 * minutes >= 120) {
+ if (-1 * minutes >= 2) {
return element.textContent = relative.format(-1 * minutes, "minute");
}
- if (-1 * seconds >= 0) {
+ if (-1 * seconds >= 1) {
return element.textContent = relative.format(-1 * seconds, "second");
}
}