Comparing Dates in Javascript

  const firstDayOfWeek = startOfWeek.toDate().getTime();
  const lastDayOfWeek = startOfWeek.add(4, 'days').toDate().getTime();
  const shift = moment(x.date).toDate().getTime();
  return shift >= firstDayOfWeek && shift <= lastDayOfWeek;
It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *