index.ts 453 B

1234567891011121314
  1. import dayjs, { type Dayjs, type ConfigType } from "../utils/dayjs";
  2. // wrapDate to the start of the day
  3. export const wrapDate = (date: ConfigType): Dayjs => {
  4. return dayjs(date).startOf("day");
  5. };
  6. export const getDates = (start: ConfigType, end: ConfigType): Dayjs[] => {
  7. start = wrapDate(start);
  8. end = wrapDate(end);
  9. const deltaDays = end.diff(start, 'day');
  10. return Array.from({ length: deltaDays + 1 }, (_, i) => start.add(i, 'day'));
  11. }