Permalink
Browse files

Fixed formatting param issues. Added comments documenting use of stri…

…ng offset for twoDigitYearMax.
  • Loading branch information...
InfinitiesLoop
InfinitiesLoop committed Jun 9, 2010
1 parent 72df551 commit 08eb8f497d7a1acde36b00772eb5e4f0b94915d3
Showing with 18 additions and 9 deletions.
  1. +3 −1 README.md
  2. +14 −7 jquery.glob.js
  3. +1 −1 jquery.glob.min.js
View
@@ -325,7 +325,9 @@ jQuery.cultures['default'] = {
{"name":"A.D.","start":null,"offset":0}
],
// when a two digit year is given, it will never be parsed as a four digit
- // year great than this year (in the appropriate era for the culture)
+ // year greater than this year (in the appropriate era for the culture)
+ // Set it as a full year (e.g. 2029) or use an offset format starting from
+ // the current year: "+19" would correspond to 2029 if the current year 2010.
twoDigitYearMax: 2029,
// set of predefined date and time patterns used by the culture
// these represent the format someone in this culture would expect
View
@@ -169,13 +169,18 @@ $.extend({
culture = $.findClosestCulture( culture );
var date;
- if ( formats && formats.length ) {
- for ( var i = 1, l = formats.length; i < l; i++ ) {
- var format = formats[ i ];
- if ( format ) {
- date = parseExact( value, format, cultureInfo );
- if ( date ) {
- break;
+ if ( formats ) {
+ if ( typeof formats === "string" ) {
+ formats = [ formats ];
+ }
+ if ( formats.length ) {
+ for ( var i = 0, l = formats.length; i < l; i++ ) {
+ var format = formats[ i ];
+ if ( format ) {
+ date = parseExact( value, format, culture );
+ if ( date ) {
+ break;
+ }
}
}
}
@@ -342,6 +347,8 @@ var en = cultures["default"] = cultures.en = $.extend(true, {
],
// when a two digit year is given, it will never be parsed as a four digit
// year greater than this year (in the appropriate era for the culture)
+ // Set it as a full year (e.g. 2029) or use an offset format starting from
+ // the current year: "+19" would correspond to 2029 if the current year 2010.
twoDigitYearMax: 2029,
// set of predefined date and time patterns used by the culture
// these represent the format someone in this culture would expect
Oops, something went wrong.

0 comments on commit 08eb8f4

Please sign in to comment.