본문 바로가기
FrontEnd/React.js

react-day-picker 에서 한글화 시키기 (feat. date-fns)

by 위그든씨 2024. 9. 4.

react-day-picker/DayPicker는 위 사진처럼 디폴트가 영어

이것에 대해 각 나라별 언어를 호환할려면 date-fns/locale을 사용하면 됨 (https://daypicker.dev/docs/translation#aria-labels)

import { DayPicker } from "react-day-picker";
import { ko } from "date-fns/locale";

<DayPicker
      locale={ko} 
      ....
      
  />

간단한 옵션 추가로 아래와 같이 한글화로 매핑됨