filter minggu lalu

import moment from 'moment'

export function filterByLaunchDateLastWeek(launches: any) {
  const todayDate = new Date()
  const startDayOfPrevWeek = moment(todayDate).subtract(1, 'week').startOf('week').format('LLLL')
  const lastDayOfPrevWeek = moment(todayDate).subtract(1, 'week').endOf('week').format('LLLL')

  return launches.filter((launch:any) => {
    const launchDate = launch.launch_date_utc
    return moment(launchDate).isBetween(startDayOfPrevWeek, lastDayOfPrevWeek)
  })
}
Worried Wolf