MomentJS - Invalid



This method allows you to define your own invalid object for a moment.

Syntax

moment.invalid(Object);

Example

In the following example, we are setting the invalidMonth and passing the same as object to invalid method. This helps to create the list of invalid checks of our choice to be validated with the moment.

var m = moment.invalid({ invalidMonth: 'reptember' });
var a = m.parsingFlags().invalidMonth;

Output

Invalid
momentjs_utilities.htm
Advertisements