Framework/React

[React] react-datepicker ํŠน์ •/์ง€๋‚œ ๋‚ ์งœ ์ œ์™ธํ•˜๋Š” ๋ฐฉ๋ฒ•

yuri lee 2023. 1. 4. 23:14
๋ฐ˜์‘ํ˜•

Intro

react-datepicker ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๋˜ ๋„์ค‘, ๋๋‚ ์งœ๊ฐ€ ์‹œ์ž‘ ๋‚ ์งœ๋ฅผ ์„ ํƒํ•  ์ˆ˜ ์—†๋„๋ก ๋‚ ์งœ๋ฅผ ์ œ์™ธํ•ด์•ผ ํ–ˆ์Šต๋‹ˆ๋‹ค. 

 

How to solve the problem

๊ตฌ๊ธ€๋ง ํ›„ ์•„๋ž˜์™€ ๊ฐ™์€ ๋‹ต๋ณ€์„ ์ฐพ์•˜์Šต๋‹ˆ๋‹ค.

<DatePicker
  selected={this.state.startDate}
  onChange={this.handleChange}
  minDate={moment().toDate()}
  placeholderText="Select a day"
/>

DatePicker ์†์„ฑ์˜ minDate๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ œ์™ธํ•  ๋‚ ์งœ๋ฅผ ๋„ฃ์–ด์ฃผ๋ฉด ๋ฉ๋‹ˆ๋‹ค. 

 


https://stackoverflow.com/questions/50626937/react-datepicker-exclude-past-dates

๋ฐ˜์‘ํ˜•