From 268f3f0880786dba250130c96a7933005f146d15 Mon Sep 17 00:00:00 2001 From: Kevin J Hoerr Date: Sat, 8 Jul 2023 15:50:44 -0400 Subject: timestamp.ts: Fix month off-by-one --- src/util/timestamp.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/util/timestamp.ts') diff --git a/src/util/timestamp.ts b/src/util/timestamp.ts index 96c5064..01b78fb 100644 --- a/src/util/timestamp.ts +++ b/src/util/timestamp.ts @@ -39,10 +39,10 @@ export function encodeBase62(valu: number): string { let res = ""; const mod = 62; - while (valu > 0) { + do { res = SHORT_CHARS[valu % mod] + res; valu = Math.floor(valu / mod); - } + } while (valu > 0); return res; } @@ -55,7 +55,7 @@ export function getTimestamp(seconds: number): string { const date = new Date(seconds * 1000); const dateArr = [ date.getUTCFullYear(), - date.getUTCMonth(), + date.getUTCMonth() + 1, // UTC month starts at 0 date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), -- cgit