MomentJS - Defaults


Advertisements

When we create moment, it gives the output as the current day, month, year, hour, minutes and seconds. We can specify the units to be default one while creating moment and the same will be displayed keeping rest same as per the current date/time.

Example

var m = moment({hour: 3, minute: 40, seconds: 10});

Note that in the above example we have defaulted the hour, minute and seconds to 03:40:10 and the same is displayed keeping rest the current date.

Output

Defaulted
momentjs_parsing_date_and_time.htm
Advertisements