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

Fails on Safari on Mac #9

Open
rroesler opened this issue May 3, 2012 · 0 comments
Open

Fails on Safari on Mac #9

rroesler opened this issue May 3, 2012 · 0 comments

Comments

@rroesler
Copy link

rroesler commented May 3, 2012

Dependency on Date(string) constructor which does not have a standardized behaviour (i.e. spec on what formats are parsable).
yyyy-mm-dd is not (on a Mac). Perhaps yyyy-mm-dd fails someplace else but mm-dd-yyyy works ?

Something like: (from http://stackoverflow.com/questions/3085937/safari-js-cannot-parse-yyyy-mm-dd-date-format)

function parseDate(input, format) {
format = format || 'yyyy-mm-dd'; // default format
var parts = input.match(/(\d+)/g),
i = 0, fmt = {};
// extract date-part indexes from the format
format.replace(/(yyyy|dd|mm)/g, function(part) { fmt[part] = i++; });

return new Date(parts[fmt['yyyy']], parts[fmt['mm']]-1, parts[fmt['dd']]);
}

might work. Trying it now !

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

1 participant