From 81543e5307c98df0d44c1cf553bcdfefbfe4ea7f Mon Sep 17 00:00:00 2001 From: mat Date: Wed, 16 Feb 2022 22:12:59 +0000 Subject: improvements --- src/lib/profile.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/lib/profile.ts') 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 -- cgit