(startDate: string, endDate: string)
| 1 | export const dateIsBetween = (startDate: string, endDate: string): boolean => { |
| 2 | const invalidDateStr = 'Invalid Date'; |
| 3 | const start = new Date(startDate); |
| 4 | const end = new Date(endDate); |
| 5 | |
| 6 | if ([start.toString(), end.toString()].includes(invalidDateStr)) { |
| 7 | throw new Error('dateIsBetween got called with invalid dates'); |
| 8 | } |
| 9 | |
| 10 | const now = new Date(); |
| 11 | |
| 12 | return start < now && now < end; |
| 13 | }; |
no outgoing calls
no test coverage detected