Better date format
Some checks failed
Build / Build NPM Project (push) Failing after 46s
Build / Publish Documentation (push) Has been skipped
Build / Tag Version (push) Has been skipped

This commit is contained in:
2025-08-01 09:54:22 -04:00
parent bfe9493d23
commit c5270fbd7e
4 changed files with 104 additions and 100 deletions

View File

@@ -48,3 +48,13 @@ export function fracToDec(frac: string) {
split = (<string>split.pop()).split('/');
return whole + (Number(split[0]) / Number(split[1]));
}
export function numSuffix(num: number): string {
if (num % 100 >= 11 && num % 100 <= 13) return `${num}th`;
switch (num % 10) {
case 1: return `${num}st`;
case 2: return `${num}nd`;
case 3: return `${num}rd`;
default: return `${num}th`;
}
}