parent
188ff03a28
commit
95ee04326a
|
@ -9,12 +9,12 @@
|
||||||
* @returns {string | null}
|
* @returns {string | null}
|
||||||
*/
|
*/
|
||||||
export function parseTime(time, cFormat) {
|
export function parseTime(time, cFormat) {
|
||||||
if (arguments.length === 0) {
|
if (arguments.length === 0 && time != null) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
|
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
|
||||||
let date
|
let date
|
||||||
if (typeof time === 'object' && time != null) {
|
if (typeof time === 'object') {
|
||||||
date = time
|
date = time
|
||||||
} else {
|
} else {
|
||||||
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
|
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
|
||||||
|
|
Loading…
Reference in New Issue