fechas de filtro JavaScript

const filterDates = (from, to) => {
  return randomDates.filter((date) => {
    return date >= from && date <= to;
  });
};

const sortDates = (dates) => {
  return dates.sort((a, b) => {
    return b - a;
  });
};
SunflowerToad