Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the parameter "true" mean in moment.js?

What does the parameter "true" mean in moment.js? For instance:

moment("2010-10-31a", ["YYYY-MM-DD"], true).isValid();
like image 296
enot Avatar asked Apr 13 '17 16:04

enot


1 Answers

Note under String + Format in the documentation, down the page a bit, there's the line:

As of version 2.3.0, you may specify a boolean for the last argument to make Moment use strict parsing. Strict parsing requires that the format and input match exactly, including delimeters.

Since it was obvious it was under the String + Format section (because that's where it shows the moment method signatures), I just navigated to there on the page, then searched for "boolean". Sure enough, that brought me to the part above.

like image 103
Carcigenicate Avatar answered Oct 09 '22 22:10

Carcigenicate