Update index.js

This commit is contained in:
xbigcat 2019-01-24 14:35:53 +08:00 committed by GitHub
parent 9f23adbc14
commit 84c65eec6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -13,7 +13,9 @@ export function parseTime(time, cFormat) {
} else {
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
time = parseInt(time)
if (time.toString().length === 10) time = time * 1000
}
if ((typeof time === 'number') && (time.toString().length === 10)) {
time = time * 1000
}
date = new Date(time)
}