furhter bug fixes and updates
This commit is contained in:
@@ -15,9 +15,12 @@ export function steamProfileUrl(steamId2: string): string | null {
|
||||
return id64 ? `https://steamcommunity.com/profiles/${id64}` : null;
|
||||
}
|
||||
|
||||
// Formats total minutes as "123h 45m" for display.
|
||||
// Formats total minutes as "123h 45m" for display. Negative values (which
|
||||
// shouldn't be possible, but have shown up from anomalous underlying data —
|
||||
// e.g. a player_time counter that decreased between two session snapshots)
|
||||
// are shown as "—" rather than a nonsensical negative duration.
|
||||
export function formatMinutes(totalMinutes: number | null): string {
|
||||
if (totalMinutes == null || Number.isNaN(totalMinutes)) return '—';
|
||||
if (totalMinutes == null || Number.isNaN(totalMinutes) || totalMinutes < 0) return '—';
|
||||
const h = Math.floor(totalMinutes / 60);
|
||||
const m = totalMinutes % 60;
|
||||
return `${h}h ${m}m`;
|
||||
|
||||
Reference in New Issue
Block a user