import moment from 'moment-timezone';
import { Incidence } from '../../infrastructure/constants/incidences';

export const filterIncidencesForNonPastDays = (incidences: Incidence[], dateString: string, timezone: string): Incidence[] => {
    const isPastDay = moment.tz(dateString, timezone).isBefore(moment.tz(timezone), 'day');
    const filtered = !isPastDay
        ? incidences.filter((incidence) => incidence !== Incidence.UNDERWORKED && incidence !== Incidence.ABSENT)
        : incidences;
    return filtered ? Array.from(new Set(filtered)) : [];
};
