Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

filter by last week

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)
  })
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: vite build output destination change 
Javascript :: javascript folder array randomizer 
Javascript :: Pointing Subdomain To A Next.js Page On Vercel 
Javascript :: RangePicker 
Javascript :: Fetch data changing on reload from array to undefined 
Javascript :: javascript What is the Comment (native) function 
Javascript :: how will you get all the matching tags in a html file javascript 
Javascript :: add flag persmison to write file nodejs 
Javascript :: Setting the default value in the drop down list in AngularJS 
Javascript :: angularjs How to pass option value and label created with ng-repeat triggered by ng-change 
Javascript :: angularjs New Entry Not reflacting in table after inserting New record in CRUD angular app 
Javascript :: angularjs Separate values in select containing 2 object 
Javascript :: Se Chartjs horizontal 
Javascript :: Changing Component File location in React native does not show in main App 
Javascript :: How to make notifications vibrate phone react native expo 
Javascript :: ngrx let 
Javascript :: assignment is to create a small website using NestJS in the backend and basic HTML CSS in the frontend 
Javascript :: Node.js and Express session handling - Back button problem 
Javascript :: react native communications 
Javascript :: show hide div in javascript 
Javascript :: Remove # id From URL When Clicked On Href Link 
Javascript :: phaser remove collider on stop 
Javascript :: puppeteer create folder 
Javascript :: 1st element in underscore javascript 
Javascript :: Good Example: Focus moved to AJAX content with tabindex="-1" after a delay 
Javascript :: Declare Function To Be Used In Class 
Javascript :: react js css style border 
Javascript :: create object in jquery dynamically 
Javascript :: var logEvenNums = function(num) {}; 
Javascript :: Backbone + Express 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =