(value: DateRangeInputValue)
| 40 | ] as const |
| 41 | |
| 42 | export function isCustomDateRange(value: DateRangeInputValue): value is DateIntervalCustomString { |
| 43 | if (typeof value !== 'string') { |
| 44 | return false |
| 45 | } |
| 46 | |
| 47 | const days = Number.parseInt(value.split('customDays')[1] ?? '0', 10) |
| 48 | |
| 49 | return value.startsWith('customDays') && !Number.isNaN(days) && days >= 0 |
| 50 | } |
| 51 | |
| 52 | export function isValidRelativeDateInterval(value: DateRangeInputValue): value is DateIntervalString { |
| 53 | return typeof value === 'string' && DATE_RANGE_INPUT_RELATIVE_RANGES.some(range => range.value === value) |
no outgoing calls
no test coverage detected