From 9bd3a905ddfc26a1331a3fd9929101ea03f62ef5 Mon Sep 17 00:00:00 2001 From: Daniele Corti Date: Fri, 10 Feb 2012 16:10:33 +0100 Subject: [PATCH] =?UTF-8?q?Using=20splice(0,0,=E2=80=A6=20when=20adding=20?= =?UTF-8?q?parser=20allow=20to=20set=20priority=20at=20new=20defined=20par?= =?UTF-8?q?sers.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- Source/Types/Date.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Types/Date.js b/Source/Types/Date.js index 69b1bcad..4a8d1679 100644 --- a/Source/Types/Date.js +++ b/Source/Types/Date.js @@ -408,7 +408,7 @@ Date.extend({ // 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; },