提交 4a822b95 编写于 作者: 潘嘉晨's avatar 潘嘉晨
上级 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 格式
0% or
您添加了 0 人 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册 或