Created
May 10, 2011 15:38
-
-
Save canweriotnow/964701 to your computer and use it in GitHub Desktop.
Patching Date.parse() to accept ISO dates (bug in Safari)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
origParse = Date.parse | |
Date.parse = (date) -> | |
timestamp = origParse(date) | |
if isNaN(timestamp) && date.match(/^\d{4}-\d{2}-\d{2}/) | |
dary = date.split('-') | |
timestamp = origParse(dary[1] + '/' + dary[2] + '/' + dary[0]) | |
return timestamp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment