Skip to content

parseTime regex fix for special characters #123

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

Closed
wants to merge 1 commit into from

Conversation

elzoiddy
Copy link

Hi,

I made a small fix that escapes regex special characters like |()[]+?... in the time separator. It's unlikely that anyone would use any separator other than " " for their time format. But if they do and they use one of the special regex characters, they won't get a "NaN" parse error.

Also, it just happens to make the regex a little simpler by matching from the end of string and ignoring the date portion in the beginning.

Let me know what you think of this patch.

Thanks

@trentrichardson
Copy link
Owner

Hey elzoiddy,

This looks like its in the right direction. But you left out the part for '.{' + dp_dateFormat.length + ',}' as this is a placeholder for the date. I will make that small tweak and commit. Also I will be adding this to dev, not the master branch.

Thanks!!

This pull request was closed.
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

Successfully merging this pull request may close these issues.

2 participants