Just to mention, since ES2017 you can write:
String(d.getHours()).padStart(2, '0')
It's supported by all browsers excluding IE. More infos on
developer.mozilla.org
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart>
.
Tekki
Am Dienstag, 17. April 2018 18:11:40 UTC+2 schrieb Roland Lammel:
>
> If it is just padding the 0 for hours I think roll your own is a fine
> approach.
>
> Maybe that, short and sound:
>
> ("0" + d.getHours()).slice(-2)
>
> ​Cheers Roland​
>
>
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.