Initial commit: Upload Checkpoint project

This commit is contained in:
Caileb 2025-05-26 22:25:42 -05:00
commit c0e3781244
32 changed files with 6121 additions and 0 deletions

20
utils/time.js Normal file
View file

@ -0,0 +1,20 @@
export function parseDuration(str) {
if (!str) return 0;
const m = /^([0-9]+)(ms|s|m|h|d)$/.exec(str);
if (!m) return 0;
const val = parseInt(m[1], 10);
switch (m[2]) {
case 'ms':
return val;
case 's':
return val * 1000;
case 'm':
return val * 60 * 1000;
case 'h':
return val * 60 * 60 * 1000;
case 'd':
return val * 24 * 60 * 60 * 1000;
default:
return 0;
}
}