Filtr do ostatniego miesiąca
export function filterByLaunchDateLastMonth(launches: any) {
const todayDate = new Date()
const startDayOfPrevMonth = moment(todayDate).subtract(1, 'month').startOf('month').format('LLLL')
const lastDayOfPrevMonth = moment(todayDate).subtract(1, 'month').endOf('month').format('LLLL')
return launches.filter((launch:any) => {
const launchDate = launch.launch_date_utc
return moment(launchDate).isBetween(startDayOfPrevMonth, lastDayOfPrevMonth)
})
}
Worried Wolf