( date: Date, baseDate: Date, options?: FormatRelativeFnOptions, )
| 5 | } from "../../../types.ts"; |
| 6 | |
| 7 | function checkWeek( |
| 8 | date: Date, |
| 9 | baseDate: Date, |
| 10 | options?: FormatRelativeFnOptions, |
| 11 | ) { |
| 12 | const baseFormat = "eeee p"; |
| 13 | |
| 14 | if (isSameWeek(date, baseDate, options)) { |
| 15 | return baseFormat; // in same week |
| 16 | } else if (date.getTime() > baseDate.getTime()) { |
| 17 | return "'下个'" + baseFormat; // in next week |
| 18 | } |
| 19 | return "'上个'" + baseFormat; // in last week |
| 20 | } |
| 21 | |
| 22 | const formatRelativeLocale = { |
| 23 | lastWeek: checkWeek, // days before yesterday, maybe in this week or last week |
nothing calls this directly
no test coverage detected