mirror of
https://github.com/tuna/mirror-web.git
synced 2025-12-25 20:32:46 +00:00
update date string generation
This commit is contained in:
parent
69d2be1a44
commit
2310206d4e
|
|
@ -51,7 +51,13 @@ window.refreshMirrorList = () => {
|
|||
d['is_new'] = new_mirrors[d['name']];
|
||||
d['show_status'] = (d.status != "success");
|
||||
// Strip the second component of last_update
|
||||
d['last_update'] = d['last_update'].replace(/(\d\d:\d\d):\d\d/, '$1');
|
||||
if (d['last_update_ts']) {
|
||||
let date = new Date(d['last_update_ts'] * 1000);
|
||||
d['last_update'] = `${('000'+date.getFullYear()).substr(-4)}-${('0'+date.getMonth()).substr(-2)}-${('0'+date.getDay()).substr(-2)}` +
|
||||
` ${('0'+date.getHours()).substr(-2)}:${('0'+date.getMinutes()).substr(-2)}`;
|
||||
} else {
|
||||
d['last_update'] = d['last_update'].replace(/(\d\d:\d\d):\d\d(\s\+\d\d\d\d)?/, '$1');
|
||||
}
|
||||
mirrors.push(d);
|
||||
}
|
||||
var result = Mark.up(mir_tmpl, {mirrors: mirrors});
|
||||
|
|
|
|||
Loading…
Reference in New Issue