@navikt/ds-react
Version:
React components from the Norwegian Labour and Welfare Administration.
11 lines • 669 B
JavaScript
import { differenceInDays } from "date-fns";
export const isVisible = ({ horizontalPosition }) => horizontalPosition <= 98 && horizontalPosition >= 0;
export const getFirstDate = (periods) => {
return periods.sort((a, b) => a.start.getTime() - b.start.getTime())[0].start;
};
export const getLastDate = (periods) => {
return periods.sort((a, b) => a.end.getTime() - b.end.getTime())[periods.length - 1].end;
};
export const withinADay = (date1, date2) => differenceInDays(date1, date2) <= 1;
export const invisiblePeriods = ({ horizontalPosition, width, }) => horizontalPosition >= 0 && horizontalPosition <= 100 && width > 0;
//# sourceMappingURL=filter.js.map