diff options
author | mat <github@matdoes.dev> | 2022-02-16 22:12:59 +0000 |
---|---|---|
committer | mat <github@matdoes.dev> | 2022-02-16 22:12:59 +0000 |
commit | 81543e5307c98df0d44c1cf553bcdfefbfe4ea7f (patch) | |
tree | 8e7f50affea5920fe3607b1168f1703acf7cb194 /src/lib/profile.ts | |
parent | 36bbe64db012aaed7ff0fadf083f191b122fa4ad (diff) | |
download | skyblock-stats-81543e5307c98df0d44c1cf553bcdfefbfe4ea7f.tar.gz skyblock-stats-81543e5307c98df0d44c1cf553bcdfefbfe4ea7f.tar.bz2 skyblock-stats-81543e5307c98df0d44c1cf553bcdfefbfe4ea7f.zip |
improvements
Diffstat (limited to 'src/lib/profile.ts')
-rw-r--r-- | src/lib/profile.ts | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/profile.ts b/src/lib/profile.ts index 6388128..973a6da 100644 --- a/src/lib/profile.ts +++ b/src/lib/profile.ts @@ -1,17 +1,16 @@ -import { constants } from './constants' import { cleanId, millisecondsToTime } from './utils' /** * Convert milliseconds since epoch into a string, but if it was within the * past week then show the timeago */ -function prettyTimestamp(ms: number) { +export function prettyTimestamp(ms: number) { const isWithinPastWeek = Date.now() - ms < 1000 * 60 * 60 * 24 * 7 const timeAsString = isWithinPastWeek ? (millisecondsToTime(Date.now() - ms) + ' ago') : (new Date(ms)).toUTCString() return timeAsString } -export function generateMetaDescription(data) { +export function generateInfobox(data, constants, opts: { meta: boolean }): string[] { const result: string[] = [] result.push(`💾 Last save: ${prettyTimestamp(data.member.last_save * 1000)}`) @@ -53,5 +52,5 @@ export function generateMetaDescription(data) { `☠${mostSignificantDeathsStat.value.toLocaleString()} ${mostSignificantDeathsStat.unit || cleanId(mostSignificantDeathsStat.rawName).toLowerCase()}` ) - return result.join('\n') + return result }
\ No newline at end of file |