freshlover / datejs

Automatically exported from code.google.com/p/datejs
0 stars 0 forks source link

[FIXED] twoDigitYearMax is now a four digit number in CultureInfo file #2

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I think there is a logic error in the parser with two digit years. 

The CultureInfo.twoDigitYearMax will return a four digit year. The year
Translator will always return true. 

year: function(s) {
return function() {
  var n = Number(s);
  this.year = (( s.length > 2 ) ? n : 
      (n + ( ( n < Date.CultureInfo.twoDigitYearMax ) ? 2000 : 1900 )));      
};
},

Original issue reported on code.google.com by geoff%co...@gtempaccount.com on 12 Nov 2007 at 2:00

GoogleCodeExporter commented 8 years ago
Minor modification to Date.Translator.year().

// New
year: function (s) {
    return function () {
        var n = Number(s);
        this.year = ((s.length > 2) ? n : 
            (n + (((n + 2000) < Date.CultureInfo.twoDigitYearMax) ? 2000 : 1900))); 
    };
},

Original comment by geoff%co...@gtempaccount.com on 13 Nov 2007 at 10:27