[Pkg-javascript-commits] [dojo] 09/32: apply regexp fix to 1.6 branch. Refs #11958 \!strict
David Prévot
taffit at moszumanska.debian.org
Thu Aug 21 17:39:07 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag 1.6.2
in repository dojo.
commit a2d2599a4df4b2b0f34c37de3fdb23667b73cdd4
Author: Adam Peller <github at peller.org>
Date: Thu Apr 7 12:49:45 2011 +0000
apply regexp fix to 1.6 branch. Refs #11958 \!strict
git-svn-id: http://svn.dojotoolkit.org/src/branches/1.6/dojo@24219 560b804f-0ae3-0310-86f3-f6aa0a117693
---
date/locale.js | 20 +++++++++-----------
tests/date/locale.js | 1 +
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/date/locale.js b/date/locale.js
index 221a211..5d670e2 100644
--- a/date/locale.js
+++ b/date/locale.js
@@ -509,31 +509,31 @@ function _buildDateTimeRE(tokens, bundle, options, pattern){
s = '\\d{2,4}';
break;
case 'M':
- s = (l>2) ? '\\S+?' : p2+'[1-9]|1[0-2]';
+ s = (l>2) ? '\\S+?' : '1[0-2]|'+p2+'[1-9]';
break;
case 'D':
- s = p2+'[1-9]|'+p3+'[1-9][0-9]|[12][0-9][0-9]|3[0-5][0-9]|36[0-6]';
+ s = '[12][0-9][0-9]|3[0-5][0-9]|36[0-6]|'+p3+'[1-9][0-9]|'+p2+'[1-9]';
break;
case 'd':
s = '3[01]|[12]\\d|'+p2+'[1-9]';
break;
case 'w':
- s = p2+'[1-9]|[1-4][0-9]|5[0-3]';
+ s = '[1-4][0-9]|5[0-3]|'+p2+'[1-9]';
break;
case 'E':
s = '\\S+';
break;
case 'h': //hour (1-12)
- s = p2+'[1-9]|1[0-2]';
+ s = '1[0-2]|'+p2+'[1-9]';
break;
case 'k': //hour (0-11)
- s = p2+'\\d|1[01]';
+ s = '1[01]|'+p2+'\\d';
break;
case 'H': //hour (0-23)
- s = p2+'\\d|1\\d|2[0-3]';
+ s = '1\\d|2[0-3]|'+p2+'\\d';
break;
case 'K': //hour (1-24)
- s = p2+'[1-9]|1\\d|2[0-4]';
+ s = '1\\d|2[0-4]|'+p2+'[1-9]';
break;
case 'm':
case 's':
@@ -545,10 +545,8 @@ function _buildDateTimeRE(tokens, bundle, options, pattern){
case 'a':
var am = options.am || bundle['dayPeriods-format-wide-am'],
pm = options.pm || bundle['dayPeriods-format-wide-pm'];
- if(options.strict){
- s = am + '|' + pm;
- }else{
- s = am + '|' + pm;
+ s = am + '|' + pm;
+ if(!options.strict){
if(am != am.toLowerCase()){ s += '|' + am.toLowerCase(); }
if(pm != pm.toLowerCase()){ s += '|' + pm.toLowerCase(); }
if(s.indexOf('.') != -1){ s += '|' + s.replace(/\./g, ""); }
diff --git a/tests/date/locale.js b/tests/date/locale.js
index f9356d3..cb37e92 100644
--- a/tests/date/locale.js
+++ b/tests/date/locale.js
@@ -107,6 +107,7 @@ tests.register("tests.date.locale",
// test dates with no spaces
t.is( aug_11_2006, dojo.date.locale.parse("11Aug2006", {selector: 'date', datePattern: 'ddMMMyyyy', locale: 'en'}));
t.is( new Date(2006, 7, 1), dojo.date.locale.parse("Aug2006", {selector: 'date', datePattern: 'MMMyyyy', locale: 'en'}));
+ t.is( new Date(2010, 10, 19), dojo.date.locale.parse("111910", {fullyear: false, datePattern: "MMddyy", selector: "date"}));
//en: 'medium' fmt: MMM d, yyyy
// Tolerate either 8 or 08 for month part.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git
More information about the Pkg-javascript-commits
mailing list