Search code examples
javascriptbrowserify

Browserify won't compile with Date lines


These two lines in my JavaScript seem to stop Browserify from compiling. The two lines are:

$( "#check_in" ).datepicker({ minDate: new Date(2015,08,27), maxDate: new Date(2015,09,03) });
$( "#check_out" ).datepicker({ minDate: new Date(2015,08,27), maxDate: new Date(2015,09,03) });

Does anyone know why this error out? The error I get is Invalid number (39:61) while parsing file:


Solution

  • Does anyone know why this error out?

    A leading 0 indicates an octal number literal. Valid digits are 0-7. 08 is therefore invalid.

    Remove leading 0s.

    Also keep in mind that Date uses zero-based months, so August would be 7, not 8.