Opened 12 years ago

Closed 12 years ago

#6242 closed defect (fixed)

[patch][CLA] fails for ddMMMyyyy (and variants)

Reported by: guest Owned by: Adam Peller
Priority: high Milestone: 1.2
Component: Date Version: 1.1b1
Keywords: Cc: [email protected]
Blocked By: Blocking:

Description (last modified by Adam Peller)

These will return null:"1Aug2006",{datePattern:"ddMMMyyyy",selector: "date",locale: "en" });"Aug2006",{datePattern:"MMMyyyy",selector: "date",locale: "en" });

yet these will return dates:"1 Aug 2006",{datePattern:"dd MMM yyyy",selector: "date",locale: "en" });"Aug 2006",{datePattern:"MMM yyyy",selector: "date",locale: "en" });

The problem is in the regular expression that is getting built up in

Here's a diff for a fix of dojo/date/locale.js:

Index: dojo/date/locale.js
--- dojo/date/locale.js (revision 13124)
+++ dojo/date/locale.js (working copy)
@@ -505,13 +505,13 @@
                                s = '\d{2,4}';
                        case 'M':
-                               s = (l>2) ? '\S+' : p2+'[1-9]|1[0-2]';
+                               s = (l>2) ? '\S+?' : p2+'[1-9]|1[0-2]';
                        case 'D':
                                s = p2+'[1-9]|'+p3+'[1-9][0-9]|[12][0-9][0-9]|3[0-5][0-9]|36[0-6]';
                        case 'd':
-                               s = p2+'[1-9]|[12]\d|3[01]';
+                               s = '[12]\d|'+p2+'[1-9]|3[01]';
                        case 'w':
                                s = p2+'[1-9]|[1-4][0-9]|5[0-3]';

And here's some tests to prove it works:

Index: dojo/tests/date/locale.js
--- dojo/tests/date/locale.js   (revision 13124)
+++ dojo/tests/date/locale.js   (working copy)
@@ -88,6 +88,10 @@
        // ...but not in strict mode
        t.f( Boolean("8/11/2006", {formatLength:'short', selector:'date', locale:'en', strict:true})));
+       // test dates with no spaces
+ aug_11_2006,"11Aug2006",{selector: 'date',datePattern: 'ddMMMyyyy'}));
+ new Date(2006,07,1),"Aug2006",{selector: 'date',datePattern: 'MMMyyyy'}));        
        //en: 'medium' fmt: MMM d, yyyy
        // Tolerate either 8 or 08 for month part. aug_11_2006,"Aug 11, 2006", {formatLength:'medium', selector:'date', locale:'en'}));

My CLA is in the mail. Hope you don't mind the fix from some joker off the street.

Attachments (1)

bug6242.diff (1.4 KB) - added by guest 12 years ago.

Download all attachments as: .zip

Change History (5)

Changed 12 years ago by guest

Attachment: bug6242.diff added

comment:1 Changed 12 years ago by Adam Peller

Milestone: 1.2

comment:2 Changed 12 years ago by Adam Peller

Summary: fails for ddMMMyyyy (and variants)[patch] fails for ddMMMyyyy (and variants)

comment:3 Changed 12 years ago by Dustin Machi

Summary: [patch] fails for ddMMMyyyy (and variants)[patch][CLA] fails for ddMMMyyyy (and variants)

comment:4 Changed 12 years ago by Adam Peller

Description: modified (diff)
Resolution: fixed
Status: newclosed

fixed in [13541]

Note: See TracTickets for help on using tickets.