fix '0' > prefixZero > '00' (should still be '0')

This commit is contained in:
Elijah Duffy
2025-12-11 15:19:33 -08:00
parent 7fd2bbb879
commit a7fa9fd6d8

View File

@@ -110,12 +110,12 @@ export const capitalizeFirstLetter = (str: string): string => {
}; };
/** /**
* prefixZero adds a leading zero to the string if it is less than 10 * prefixZero adds a leading zero to the string if it is less than 10 and not 0
* @param str The string to prefix * @param str The string to prefix
* @returns The string with a leading zero if it was only 1 digit long * @returns The string with a leading zero if it was only 1 digit long
*/ */
export const prefixZero = (str: string): string => { export const prefixZero = (str: string): string => {
if (str.length === 1) { if (str.length === 1 && str !== '0') {
return '0' + str; return '0' + str;
} }
return str; return str;