fix(common(js)): improve parsing of year
There's no perfect solution when only two digits are used for the year. It's always better to show four digits for the year to avoid unexpected results. Fixes #5268pull/296/head
parent
088764a3f7
commit
6f90977196
|
@ -210,7 +210,7 @@ String.prototype.parseDate = function(localeProvider, format) {
|
||||||
return (i >= 0);
|
return (i >= 0);
|
||||||
}],
|
}],
|
||||||
'%y': [/\d\d/, function(input) {
|
'%y': [/\d\d/, function(input) {
|
||||||
var nearFuture = parseInt(now.getFullYear().toString().substring(2)) + 5;
|
var nearFuture = parseInt(now.getFullYear().toString().substring(2)) + 50;
|
||||||
date.year = parseInt(input);
|
date.year = parseInt(input);
|
||||||
if (date.year < nearFuture) date.year += 2000;
|
if (date.year < nearFuture) date.year += 2000;
|
||||||
else date.year += 1900;
|
else date.year += 1900;
|
||||||
|
|
Loading…
Reference in New Issue