This repository has been archived by the owner on Mar 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #304 from watermelontools/fix/broken-deactivation-…
…text Fix/broken deactivation text
- Loading branch information
Showing
5 changed files
with
54 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,6 +118,7 @@ export default async function getAllServices({ | |
amount: AsanaTasks, | ||
}), | ||
]); | ||
|
||
return { | ||
github, | ||
jira, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
export default function getRelativeDate(isoDateString: string): string { | ||
|
||
const date = new Date(isoDateString); | ||
const now = new Date(); | ||
|
||
const diffInSeconds = (now.getTime() - date.getTime()) / 1000; | ||
|
||
if (diffInSeconds < 60) { | ||
return 'Just now'; | ||
} | ||
|
||
const diffInMinutes = diffInSeconds / 60; | ||
if (diffInMinutes < 60) { | ||
return `${Math.floor(diffInMinutes)} minutes ago`; | ||
} | ||
|
||
const diffInHours = diffInMinutes / 60; | ||
if (diffInHours < 24) { | ||
return `${Math.floor(diffInHours)} hours ago`; | ||
} | ||
|
||
const diffInDays = diffInHours / 24; | ||
if (diffInDays < 7) { | ||
return `${Math.floor(diffInDays)} days ago`; | ||
} | ||
|
||
const diffInWeeks = diffInDays / 7; | ||
if (diffInWeeks < 5) { | ||
return `${Math.floor(diffInWeeks)} weeks ago`; | ||
} | ||
|
||
const diffInMonths = diffInDays / 30; | ||
if (diffInMonths < 12) { | ||
return `${Math.floor(diffInMonths)} months ago`; | ||
} | ||
|
||
const diffInYears = diffInMonths / 12; | ||
return `${Math.floor(diffInYears)} years ago`; | ||
|
||
} | ||
|