(dateStr)
| 616 | }, |
| 617 | |
| 618 | relativeTime(dateStr) { |
| 619 | if (!dateStr) return '-'; |
| 620 | const date = new Date(dateStr); |
| 621 | const now = new Date(); |
| 622 | const diff = now - date; |
| 623 | const seconds = Math.floor(diff / 1000); |
| 624 | const minutes = Math.floor(seconds / 60); |
| 625 | const hours = Math.floor(minutes / 60); |
| 626 | const days = Math.floor(hours / 24); |
| 627 | |
| 628 | if (seconds < 60) return '刚刚'; |
| 629 | if (minutes < 60) return `${minutes} 分钟前`; |
| 630 | if (hours < 24) return `${hours} 小时前`; |
| 631 | if (days < 7) return `${days} 天前`; |
| 632 | return this.dateShort(dateStr); |
| 633 | }, |
| 634 | |
| 635 | bytes(bytes) { |
| 636 | if (bytes === 0) return '0 B'; |
nothing calls this directly
no outgoing calls
no test coverage detected