({
weekStart,
weekEnd,
}: {
weekStart: string;
weekEnd: string;
})
| 43 | // "Oct 26 to Nov 1": the week ends the Monday after, so the last day is the |
| 44 | // Sunday before it |
| 45 | export const getIntelWeekLabel = ({ |
| 46 | weekStart, |
| 47 | weekEnd, |
| 48 | }: { |
| 49 | weekStart: string; |
| 50 | weekEnd: string; |
| 51 | }): string => { |
| 52 | const format = (date: Date) => |
| 53 | date.toLocaleDateString('en-US', { |
| 54 | month: 'short', |
| 55 | day: 'numeric', |
| 56 | timeZone: 'UTC', |
| 57 | }); |
| 58 | const lastDay = new Date(new Date(weekEnd).getTime() - 24 * 60 * 60 * 1000); |
| 59 | |
| 60 | return `${format(new Date(weekStart))} to ${format(lastDay)}`; |
| 61 | }; |
no test coverage detected