(
{
startDate,
endDate,
range,
}: Pick<IReportInput, 'endDate' | 'startDate' | 'range'>,
timezone: string
)
| 246 | } |
| 247 | |
| 248 | export function getChartStartEndDate( |
| 249 | { |
| 250 | startDate, |
| 251 | endDate, |
| 252 | range, |
| 253 | }: Pick<IReportInput, 'endDate' | 'startDate' | 'range'>, |
| 254 | timezone: string |
| 255 | ) { |
| 256 | const normalizedStart = startDate |
| 257 | ? normalizeBoundary(startDate, 'start') |
| 258 | : startDate; |
| 259 | const normalizedEnd = endDate ? normalizeBoundary(endDate, 'end') : endDate; |
| 260 | |
| 261 | if (normalizedStart && normalizedEnd) { |
| 262 | return { startDate: normalizedStart, endDate: normalizedEnd }; |
| 263 | } |
| 264 | |
| 265 | const ranges = getDatesFromRange(range, timezone); |
| 266 | if (!normalizedStart && normalizedEnd) { |
| 267 | return { startDate: ranges.startDate, endDate: normalizedEnd }; |
| 268 | } |
| 269 | |
| 270 | return ranges; |
| 271 | } |
| 272 | |
| 273 | export function getChartPrevStartEndDate({ |
| 274 | startDate, |
no test coverage detected