We display a column of dates and times, and use Moment.js to format the text that is displayed:
Let's assume that adate is September 9, 2013 and the time is 08:00 AM.
var formatted = moment(adate).format("L LT");
The date is perfect and is zero padded, for example: 09/22/2013
The time is not zero padded; I am getting 8:00
Is there a way to tell Moment.js to zero pad the time, so my column of dates and times looks good?
I am using version 2.1.0.
You need to alter the longDateFormat (docs):
LT: "hh:mm A"
(the hh is the important bit)Result:
I haven't tested to see if you can just set the LT by itself. Seems possible/likely.