I have an Integer input that I want to output as 2 digits.
Besides using padStart()
String(month).padStart(2, '0')
My current solution:
`${String(month).length > 1 ? '' : '0'}${month}`
Is there a more elegant/another way to do the same?
I have an Integer input that I want to output as 2 digits.
Besides using padStart()
String(month).padStart(2, '0')
My current solution:
`${String(month).length > 1 ? '' : '0'}${month}`
Is there a more elegant/another way to do the same?