fix '0' > prefixZero > '00' (should still be '0')
This commit is contained in:
@@ -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
|
||||
* @returns The string with a leading zero if it was only 1 digit long
|
||||
*/
|
||||
export const prefixZero = (str: string): string => {
|
||||
if (str.length === 1) {
|
||||
if (str.length === 1 && str !== '0') {
|
||||
return '0' + str;
|
||||
}
|
||||
return str;
|
||||
|
||||
Reference in New Issue
Block a user