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

[Date] set higher priority at new defined parsers #1100

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Using splice(0,0,… when adding parser allow to set priority at new de…
…fined parsers.

e.g. if I add a parser for European dates

Date.defileParser("%d/%m/%Y");

without this change all strings with the day under 13th of month, like 09/02/2012, will be parsed in the american date, the example will be 2 September 2012, not 9 February 2012.
danielecorti81 committed Feb 10, 2012
commit 9bd3a905ddfc26a1331a3fd9929101ea03f62ef5
2 changes: 1 addition & 1 deletion Source/Types/Date.js
Original file line number Diff line number Diff line change
@@ -408,7 +408,7 @@ Date.extend({
//</1.2compat>

defineParser: function(pattern){
parsePatterns.push((pattern.re && pattern.handler) ? pattern : build(pattern));
parsePatterns.splice(0,0,(pattern.re && pattern.handler) ? pattern : build(pattern));
return this;
},