Showing
1 changed file
with
13 additions
and
7 deletions
| ... | @@ -178,13 +178,19 @@ const loadMore = () => { | ... | @@ -178,13 +178,19 @@ const loadMore = () => { |
| 178 | const formatDate = (dateString) => { | 178 | const formatDate = (dateString) => { |
| 179 | if (!dateString) return ''; | 179 | if (!dateString) return ''; |
| 180 | const date = new Date(dateString); | 180 | const date = new Date(dateString); |
| 181 | - return date.toLocaleString('zh-CN', { | 181 | + |
| 182 | - year: 'numeric', | 182 | + const year = date.getFullYear(); |
| 183 | - month: '2-digit', | 183 | + const month = String(date.getMonth() + 1).padStart(2, '0'); |
| 184 | - day: '2-digit', | 184 | + const day = String(date.getDate()).padStart(2, '0'); |
| 185 | - hour: '2-digit', | 185 | + const hours = date.getHours(); |
| 186 | - minute: '2-digit' | 186 | + const minutes = String(date.getMinutes()).padStart(2, '0'); |
| 187 | - }); | 187 | + |
| 188 | + // 判断上午下午 | ||
| 189 | + const period = hours < 12 ? '上午' : '下午'; | ||
| 190 | + // 转换为12小时制 | ||
| 191 | + const displayHours = String(hours % 12 || 12).padStart(2, '0'); | ||
| 192 | + | ||
| 193 | + return `${year}-${month}-${day} ${period}${displayHours}:${minutes}`; | ||
| 188 | }; | 194 | }; |
| 189 | 195 | ||
| 190 | /** | 196 | /** | ... | ... |
-
Please register or login to post a comment