본문 바로가기
모바일 APP/React-Native

공휴일 제외하는 함수 만들기

by 살길바라냐 2021. 8. 24.
반응형
  const ExceptWeekend = () => {
      const today = new Date()
      let yesterDay = new Date(today.setDate(today.getDate() - 1))
      if (yesterDay.getDay() === 0) {
        yesterDay = new Date(today.setDate(today.getDate() - 2))
      } else if (yesterDay.getDay() === 6) {
        yesterDay = new Date(today.setDate(today.getDate() - 1))
      }
      console.log('!!!', yesterDay)
    }

 

728x90