mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 20:25:43 +00:00
Fix: Format entire frontend properly
This commit is contained in:
@@ -4,32 +4,30 @@
|
||||
* @returns {String} text - how much time has passed since a certain timestamp
|
||||
*/
|
||||
function timeSince(date: Date) {
|
||||
const seconds = Math.floor(
|
||||
((new Date() as any) - (date as any)) / 1000
|
||||
) as number;
|
||||
const seconds = Math.floor(((new Date() as any) - (date as any)) / 1000) as number;
|
||||
|
||||
let interval = seconds / 31536000;
|
||||
|
||||
if (interval > 1) {
|
||||
return `${Math.floor(interval) } years ago`;
|
||||
return `${Math.floor(interval)} years ago`;
|
||||
}
|
||||
interval = seconds / 2592000;
|
||||
if (interval > 1) {
|
||||
return `${Math.floor(interval) } months ago`;
|
||||
return `${Math.floor(interval)} months ago`;
|
||||
}
|
||||
interval = seconds / 86400;
|
||||
if (interval > 1) {
|
||||
return `${Math.floor(interval) } days ago`;
|
||||
return `${Math.floor(interval)} days ago`;
|
||||
}
|
||||
interval = seconds / 3600;
|
||||
if (interval > 1) {
|
||||
return `${Math.floor(interval) } hours ago`;
|
||||
return `${Math.floor(interval)} hours ago`;
|
||||
}
|
||||
interval = seconds / 60;
|
||||
if (interval > 1) {
|
||||
return `${Math.floor(interval) } minutes ago`;
|
||||
return `${Math.floor(interval)} minutes ago`;
|
||||
}
|
||||
return `${Math.floor(seconds) } seconds ago`;
|
||||
return `${Math.floor(seconds)} seconds ago`;
|
||||
}
|
||||
|
||||
export default timeSince;
|
||||
|
||||
Reference in New Issue
Block a user