aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorKevin J Hoerr <kjhoerr@protonmail.com>2023-07-08 15:50:44 -0400
committerKevin J Hoerr <kjhoerr@protonmail.com>2023-07-08 15:50:44 -0400
commit268f3f0880786dba250130c96a7933005f146d15 (patch)
tree82053859331344abb23f9d87e4f9acd531ec46fe /src
parent563c592a461428ec59c32eb6ba49159ef3ee6f0d (diff)
downloadsubmelon.dev-268f3f0880786dba250130c96a7933005f146d15.tar.gz
submelon.dev-268f3f0880786dba250130c96a7933005f146d15.tar.bz2
submelon.dev-268f3f0880786dba250130c96a7933005f146d15.zip
timestamp.ts: Fix month off-by-one
Diffstat (limited to 'src')
-rw-r--r--src/util/timestamp.ts6
1 files changed, 3 insertions, 3 deletions
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(),