Skip to content

Commit

Permalink
Fix time localization test by make the year dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
Kian Esmaeilpour committed May 18, 2020
1 parent 80c93d5 commit e89d3df
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ describe('ts.ui.TimeSpirit', function likethis() {
'zh-TW': '2 年前'
};
var codes = Object.keys(tests);
const currentYear = Number(new Date().getUTCFullYear());
codes.forEach(function(code, i) {
setup(function(spirit) {
var html = spirit.element.innerHTML.replace(/\d/g, '');
Expand All @@ -55,7 +56,11 @@ describe('ts.ui.TimeSpirit', function likethis() {
if (i === codes.length - 1) {
done();
}
}, '<time data-ts="Time" lang="' + code + '" datetime="2015-11-04 03:59:33"></time>');
}, '<time data-ts="Time" lang="' +
code +
'" datetime="' +
(currentYear - 2) +
'-11-04 03:59:33"></time>');
});
});
});

0 comments on commit e89d3df

Please sign in to comment.