mirror of
https://github.com/thiloho/archtika.git
synced 2025-11-22 10:51:36 +01:00
Add ability to export articles, track publications in json file on NGINX, fix vulnerabilities and refactor
This commit is contained in:
@@ -4,6 +4,12 @@
|
||||
const dateObject = new Date(date);
|
||||
|
||||
const calcTimeAgo = (date: Date) => {
|
||||
const secondsElapsed = (date.getTime() - Date.now()) / 1000;
|
||||
|
||||
if (Math.abs(secondsElapsed) < 1) {
|
||||
return "Just now";
|
||||
}
|
||||
|
||||
const formatter = new Intl.RelativeTimeFormat("en");
|
||||
const ranges = [
|
||||
["years", 60 * 60 * 24 * 365],
|
||||
@@ -14,7 +20,6 @@
|
||||
["minutes", 60],
|
||||
["seconds", 1]
|
||||
] as const;
|
||||
const secondsElapsed = (date.getTime() - Date.now()) / 1000;
|
||||
|
||||
for (const [rangeType, rangeVal] of ranges) {
|
||||
if (rangeVal < Math.abs(secondsElapsed)) {
|
||||
|
||||
Reference in New Issue
Block a user