Skip to content

Commit

Permalink
fix(common(js)): improve parsing of year
Browse files Browse the repository at this point in the history
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 #5268
  • Loading branch information
cgx committed Mar 2, 2021
1 parent 088764a commit 6f90977
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion UI/WebServerResources/js/Common/utils.js
Expand Up @@ -210,7 +210,7 @@ String.prototype.parseDate = function(localeProvider, format) {
return (i >= 0);
}],
'%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);
if (date.year < nearFuture) date.year += 2000;
else date.year += 1900;
Expand Down

0 comments on commit 6f90977

Please sign in to comment.