Commit 4a822b95 authored by 潘嘉晨's avatar 潘嘉晨
parent aff349a8
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* @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) {
return null return null
} }
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}' const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
......
...@@ -28,4 +28,8 @@ describe('Utils:parseTime', () => { ...@@ -28,4 +28,8 @@ describe('Utils:parseTime', () => {
it('empty argument', () => { it('empty argument', () => {
expect(parseTime()).toBeNull() expect(parseTime()).toBeNull()
}) })
it('null', () => {
expect(parseTime(null)).toBeNull()
})
}) })
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment