Skip to content

Commit

Permalink
fix: stringify function returns a error value,when date is null (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
mengxiong10 committed Feb 1, 2019
1 parent 6214970 commit 92243ab
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export function formatTime (time, type = '24', a = 'a') {
}

export function formatDate (date, format) {
if (!date) {
return ''
}
try {
return fecha.format(new Date(date), format)
} catch (e) {
Expand Down

0 comments on commit 92243ab

Please sign in to comment.