mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-05 07:10:30 +01:00
closes #6983
after first pass of timeago, title contains "21 lis 2018, 10:30" which is invalid for new Date(), check before passing it to format
This commit is contained in:
@@ -122,6 +122,7 @@ if (typeof window !== 'undefined') {
|
||||
var options = { year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: 'numeric' };
|
||||
var dtFormat = new Intl.DateTimeFormat(userLang, options);
|
||||
var iso;
|
||||
var date;
|
||||
$.fn.timeago = function () {
|
||||
var els = $(this);
|
||||
// Convert "old" format to new format (#5108)
|
||||
@@ -131,7 +132,10 @@ if (typeof window !== 'undefined') {
|
||||
return;
|
||||
}
|
||||
this.setAttribute('datetime', iso);
|
||||
this.textContent = dtFormat.format(new Date(iso));
|
||||
date = new Date(iso);
|
||||
if (!isNaN(date)) {
|
||||
this.textContent = dtFormat.format(date);
|
||||
}
|
||||
});
|
||||
|
||||
timeagoFn.apply(this, arguments);
|
||||
|
||||
Reference in New Issue
Block a user