|
@@ -17,9 +17,17 @@ export function parseTime(time, cFormat) {
|
17
|
17
|
if (typeof time === 'object') {
|
18
|
18
|
date = time
|
19
|
19
|
} else {
|
20
|
|
- if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
|
21
|
|
- time = parseInt(time)
|
|
20
|
+ if ((typeof time === 'string')) {
|
|
21
|
+ if ((/^[0-9]+$/.test(time))) {
|
|
22
|
+ // support "1548221490638"
|
|
23
|
+ time = parseInt(time)
|
|
24
|
+ } else {
|
|
25
|
+ // support safari
|
|
26
|
+ // https://stackoverflow.com/questions/4310953/invalid-date-in-safari
|
|
27
|
+ time = time.replace(new RegExp(/-/gm), '/')
|
|
28
|
+ }
|
22
|
29
|
}
|
|
30
|
+
|
23
|
31
|
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
24
|
32
|
time = time * 1000
|
25
|
33
|
}
|