Skip to content

Commit 92243ab

Browse files
committed
fix: stringify function returns a error value,when date is null (#244)
1 parent 6214970 commit 92243ab

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/utils/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ export function formatTime (time, type = '24', a = 'a') {
5555
}
5656

5757
export function formatDate (date, format) {
58+
if (!date) {
59+
return ''
60+
}
5861
try {
5962
return fecha.format(new Date(date), format)
6063
} catch (e) {

0 commit comments

Comments
 (0)