timrwood/moment — Issue #151: Formatted dates crashing in regex parser
Author: jat850
Created: 2012-02-01 23:57:55+00:00
State: open

I am trying to (against all recommendations in the documentation, I realize) use an array of formatted date strings and there seems to be a crash in the regex parser when specifying timezone offsets as part of the format.

Example:

var bem = moment(datestring, [ "YYYY ZZ"]);

will pass with the input "2012 -0600".

However, if I add:
"YYYY-MM ZZ" to the formatted strings array (so my array is now [ "YYYY ZZ", "YYYY-MM ZZ" ] I get the following crash:

TypeError: Cannot call method 'match' of undefined
at addTime (/home/jat850/project/node_modules/moment/moment.js:293:27)

This crash occurs even when specifying my original input of 2012 -0600.