aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/utils/Time.ts
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/utils/Time.ts')
-rw-r--r--frontend/src/utils/Time.ts26
1 files changed, 13 insertions, 13 deletions
diff --git a/frontend/src/utils/Time.ts b/frontend/src/utils/Time.ts
index 34830b0..8f2c03c 100644
--- a/frontend/src/utils/Time.ts
+++ b/frontend/src/utils/Time.ts
@@ -6,47 +6,47 @@ export function time_ago(date: any) {
6 6
7 let interval = Math.floor(seconds / 31536000); 7 let interval = Math.floor(seconds / 31536000);
8 if (interval === 1) { 8 if (interval === 1) {
9 return interval + ' year ago'; 9 return interval + " year ago";
10 } 10 }
11 if (interval > 1) { 11 if (interval > 1) {
12 return interval + ' years ago'; 12 return interval + " years ago";
13 } 13 }
14 14
15 interval = Math.floor(seconds / 2592000); 15 interval = Math.floor(seconds / 2592000);
16 if (interval === 1) { 16 if (interval === 1) {
17 return interval + ' month ago'; 17 return interval + " month ago";
18 } 18 }
19 if (interval > 1) { 19 if (interval > 1) {
20 return interval + ' months ago'; 20 return interval + " months ago";
21 } 21 }
22 22
23 interval = Math.floor(seconds / 86400); 23 interval = Math.floor(seconds / 86400);
24 if (interval === 1) { 24 if (interval === 1) {
25 return interval + ' day ago'; 25 return interval + " day ago";
26 } 26 }
27 if (interval > 1) { 27 if (interval > 1) {
28 return interval + ' days ago'; 28 return interval + " days ago";
29 } 29 }
30 30
31 interval = Math.floor(seconds / 3600); 31 interval = Math.floor(seconds / 3600);
32 if (interval === 1) { 32 if (interval === 1) {
33 return interval + ' hour ago'; 33 return interval + " hour ago";
34 } 34 }
35 if (interval > 1) { 35 if (interval > 1) {
36 return interval + ' hours ago'; 36 return interval + " hours ago";
37 } 37 }
38 38
39 interval = Math.floor(seconds / 60); 39 interval = Math.floor(seconds / 60);
40 if (interval === 1) { 40 if (interval === 1) {
41 return interval + ' minute ago'; 41 return interval + " minute ago";
42 } 42 }
43 if (interval > 1) { 43 if (interval > 1) {
44 return interval + ' minutes ago'; 44 return interval + " minutes ago";
45 } 45 }
46 46
47 if (seconds < 10) return 'just now'; 47 if (seconds < 10) return "just now";
48 48
49 return Math.floor(seconds) + ' seconds ago'; 49 return Math.floor(seconds) + " seconds ago";
50} 50}
51 51
52export function ticks_to_time(ticks: number) { 52export function ticks_to_time(ticks: number) {
@@ -58,5 +58,5 @@ export function ticks_to_time(ticks: number) {
58 seconds = seconds % 60; 58 seconds = seconds % 60;
59 minutes = minutes % 60; 59 minutes = minutes % 60;
60 60
61 return `${hours === 0 ? '' : hours + ':'}${minutes === 0 ? '' : hours > 0 ? minutes.toString().padStart(2, '0') + ':' : minutes + ':'}${minutes > 0 ? seconds.toString().padStart(2, '0') : seconds}.${milliseconds.toString().padStart(3, '0')}`; 61 return `${hours === 0 ? "" : hours + ":"}${minutes === 0 ? "" : hours > 0 ? minutes.toString().padStart(2, "0") + ":" : minutes + ":"}${minutes > 0 ? seconds.toString().padStart(2, "0") : seconds}.${milliseconds.toString().padStart(3, "0")}`;
62} 62}