Just add the leading 0 every time, then use slice(-2)
to get the last two characters, like so:
('0' + currentDate.getHours()).slice(-2)
Just add the leading 0 every time, then use slice(-2)
to get the last two characters, like so:
('0' + currentDate.getHours()).slice(-2)