Do not convert to Dates twice (#5563)
* Don't convert Dates twice * Take string dates into account
This commit is contained in:
parent
df9096df80
commit
1288b4b28f
@ -92,6 +92,16 @@ export function outChainStatus (status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function outDate (date) {
|
export function outDate (date) {
|
||||||
|
if (typeof date.toISOString === 'function') {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (typeof date === 'string' && (new Date(date)).toISOString() === date) {
|
||||||
|
return new Date(date);
|
||||||
|
}
|
||||||
|
} catch (error) {}
|
||||||
|
|
||||||
return new Date(outNumber(date).toNumber() * 1000);
|
return new Date(outNumber(date).toNumber() * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user