Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#13057 closed defect (fixed)

'DDD' improper handling of leading zeros

Reported by: Adam Peller Owned by: Adam Peller
Priority: high Milestone: 1.7
Component: Date Version: 1.6.1
Keywords: Cc:
Blocked By: Blocking:

Description

reported by jodymbrooks: I am using Dojo 1.5.0 (although basically same for 1.6.1). I have a constraint on a DateTextBox? as such: constraints: { datePattern: 'DDD', },

which does not properly validate a value like '003' (anything in the first 9 days of the year actually).

I have traced this down to dojo.date.locale and the function regexp and subsequently to the function _buildDateTimeRE. For the 'D' case, I believe the 'p2' and 'p3' variables should be swapped. The resulting regexp (dojo 1.5.0) is:

(0?[1-9]|0{0,2}[1-9][0-9]|[12][0-9][0-9]|3[0-5][0-9]|36[0-6])

The bold parts are p2 and p3 respectively and the code that generates this is: p2 = '0?'; p3 = '0{0,2}';

...

s = p2+'[1-9]|'+p3+'[1-9][0-9]|[12][0-9][0-9]|3[0-5][0-9]|36[0-6]'; I believe it should be this (or something similar) s = p2+'[1-9][0-9]|'+p3+'[1-9]|[12][0-9][0-9]|3[0-5][0-9]|36[0-6]';

Change History (2)

comment:1 Changed 9 years ago by Adam Peller

Resolution: fixed
Status: newclosed

(In [25146]) Correct handling of multiple leading zeros. Fixes #13057

comment:2 Changed 9 years ago by Adam Peller

(In [25147]) Correct handling of multiple leading zeros. Fixes #13057 \!strict

Note: See TracTickets for help on using tickets.