Skip to content

Instantly share code, notes, and snippets.

@canweriotnow
Created May 10, 2011 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save canweriotnow/964701 to your computer and use it in GitHub Desktop.
Save canweriotnow/964701 to your computer and use it in GitHub Desktop.
Patching Date.parse() to accept ISO dates (bug in Safari)
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