( ts: number | string | Date | undefined | null, )
| 29 | * 相对时间(2 小时前) |
| 30 | */ |
| 31 | export function fmtRelative( |
| 32 | ts: number | string | Date | undefined | null, |
| 33 | ): string { |
| 34 | if (!ts) return '-'; |
| 35 | const d = dayjs(ts); |
| 36 | if (!d.isValid()) return '-'; |
| 37 | return d.fromNow(); |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * 订单号截断显示(a1b2c3...) |
no outgoing calls
no test coverage detected