Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Fix parseAllDates() that could break dates (in listing) (#1749)

* Fix parseAllDates() that could break dates (in listing)

Fix parseAllDates() that would break torrent list dates if it had already been executed before

* check if date value is NaN before applying it
Cette révision appartient à :
kilo 2018-01-09 00:24:08 +01:00 révisé par ewhal
Parent 1eecbfecd0
révision 860f9c8eb1

Voir le fichier

@ -59,8 +59,10 @@ function parseAllDates() {
var list = document.getElementsByClassName("date-short")
for(var i = 0; i < list.length; i++) {
var e = list[i]
e.innerText = new Date(e.title).toLocaleString(lang, ymdOpt)
e.title = new Date(e.title).toLocaleString(lang)
var newDate = new Date(e.title)
if(isNaN(newDate.valueOf())) continue
e.innerText = newDate.toLocaleString(lang, ymdOpt)
e.title = newDate.toLocaleString(lang)
}
var list = document.getElementsByClassName("date-full")