diff options
| author | Factiven <[email protected]> | 2023-10-22 19:43:17 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-10-22 19:43:17 +0700 |
| commit | f801f8f422954b884a6541321dba0669ee9d6173 (patch) | |
| tree | e0d5e106b99e9b4e0a4c4bf7bb0464617db85b8d /utils/getTimes.js | |
| parent | Bump @babel/traverse from 7.22.8 to 7.23.2 (#90) (diff) | |
| download | moopa-4.2.0.tar.xz moopa-4.2.0.zip | |
Update v4.2.0 (#93)v4.2.0
Diffstat (limited to 'utils/getTimes.js')
| -rw-r--r-- | utils/getTimes.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/utils/getTimes.js b/utils/getTimes.js index d06f797..491d139 100644 --- a/utils/getTimes.js +++ b/utils/getTimes.js @@ -132,3 +132,10 @@ export function unixTimestampToRelativeTime(unixTimestamp) { return "just now"; } + +export function unixToSeconds(unixTimestamp) { + const now = Math.floor(Date.now() / 1000); // Current Unix timestamp in seconds + const secondsAgo = now - unixTimestamp; + + return secondsAgo; +} |