mirror of
https://gitlab.com/MrFry/qmining-page
synced 2025-04-01 20:23:44 +02:00
p2p info invalid date fix
This commit is contained in:
parent
5d24000e1e
commit
ba5c3f8e76
1 changed files with 9 additions and 2 deletions
|
@ -73,6 +73,13 @@ const infos = [
|
|||
},
|
||||
]
|
||||
|
||||
function getDateString(dateNumber) {
|
||||
if (Number.isNaN(+dateNumber)) {
|
||||
return ' - '
|
||||
}
|
||||
return new Date(dateNumber).toLocaleString()
|
||||
}
|
||||
|
||||
export default function P2PInfo({ globalState, setGlobalState }) {
|
||||
const [p2pInfo, setP2pinfo] = useState()
|
||||
const info = p2pInfo
|
||||
|
@ -136,7 +143,7 @@ export default function P2PInfo({ globalState, setGlobalState }) {
|
|||
let text = info[key]
|
||||
switch (type) {
|
||||
case 'date':
|
||||
text = new Date(text).toLocaleString()
|
||||
text = getDateString(text)
|
||||
break
|
||||
case 'number':
|
||||
text = text.toLocaleString()
|
||||
|
@ -169,7 +176,7 @@ export default function P2PInfo({ globalState, setGlobalState }) {
|
|||
{peer.host}:{peer.port}
|
||||
</a>
|
||||
</div>
|
||||
<div>{new Date(peer.lastSync).toLocaleString()}</div>
|
||||
<div>{getDateString(peer.lastSync)}</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue