Skip to content

Commit 20fedea

Browse files
committed
fix(SPA): 无时间时显示为 NaN 的问题
issue #655
1 parent 67ce27a commit 20fedea

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

resources/spa/src/filters.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,12 @@ export const time2tips = date => {
102102
.toLocaleDateString() // > "2018/10/19"
103103
.replace(/^\d{4}\/(\d{2})\/(\d{2})/, '$1-$2') // > 10-19
104104
} catch (e) {
105-
return offset
105+
console.warn('time2tips error: ', { date, time }) // eslint-disable-line no-console
106+
return ''
106107
}
107108
if (offset < 3600 * 24 * 2) return i18n.t('date.yesterday', { time: timeStr })
108109
if (offset < 3600 * 24 * 9) return i18n.t('date.days_ago', { day: ~~(offset / 3600 / 24) })
109-
// 根据 time 06-19
110+
110111
return dateStr
111112
}
112113

0 commit comments

Comments
 (0)