Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatted dates crashing in regex parser #151

Closed
jat850 opened this issue Feb 1, 2012 · 1 comment
Closed

Formatted dates crashing in regex parser #151

jat850 opened this issue Feb 1, 2012 · 1 comment
Milestone

Comments

@jat850
Copy link

jat850 commented Feb 1, 2012

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.

timrwood added a commit that referenced this issue Feb 2, 2012
Adding some null checks and string typecasting for the timezone parser
timrwood added a commit that referenced this issue Feb 2, 2012
@timrwood
Copy link
Member

timrwood commented Feb 2, 2012

I think that will fix it. Just added some null checks and typecasting to the timezone parser.

@timrwood timrwood closed this as completed Feb 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants