import { Available, availableToDays } from 'src/pointOfInterest/enum/available.enum';

export const isPlaceOpen = (available: Available, startDate?: Date, endDate?: Date): boolean => {
  const curDayName: string = new Date().toLocaleDateString('en-US', { weekday: 'long' });
  if (available !== Available.CUSTOM) {
    return availableToDays[available].includes(curDayName);
  }
  const curDate: Date = new Date();
  return curDate >= startDate && curDate <= endDate;
};
