|
|
|
@ -17,11 +17,17 @@ export function parseTime(time, cFormat) {
|
|
|
|
|
if (typeof time === 'object') {
|
|
|
|
|
date = time
|
|
|
|
|
} else {
|
|
|
|
|
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
|
|
|
|
|
time = parseInt(time)
|
|
|
|
|
} else if (typeof time === 'string') {
|
|
|
|
|
time = time.replace(new RegExp(/-/gm), '/');
|
|
|
|
|
if ((typeof time === 'string')) {
|
|
|
|
|
if ((/^[0-9]+$/.test(time))) {
|
|
|
|
|
// support "1548221490638"
|
|
|
|
|
time = parseInt(time)
|
|
|
|
|
} else {
|
|
|
|
|
// support safari
|
|
|
|
|
// https://stackoverflow.com/questions/4310953/invalid-date-in-safari
|
|
|
|
|
time = time.replace(new RegExp(/-/gm), '/')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
|
|
|
|
time = time * 1000
|
|
|
|
|
}
|
|
|
|
|