Skip to content

vvvroom/react-dates-fns

 
 

Repository files navigation

react-dates-fns

An easily internationalizable, accessible, mobile-friendly datepicker library for the web. (Using date-fns instead of moment)

react-dates in action

For examples of the datepicker in action, go to http://airbnb.io/react-dates.

To use a locale:

Add date-fns supported languages to utils/getLocale.js

import enUS from 'date-fns/locale/en-US';
import ptBR from 'date-fns/locale/pt-BR';
import zhCN from 'date-fns/locale/zh-CN';

export default function getLocale(locale) {
  switch (locale) {
    case 'en-US':
      return enUS;
    case 'pt-BR':
      return ptBR;
    case 'zh-CN':
      return zhCN;
    default:
      return enUS;
  }
}

Pass the locale to component like this:

<DateRangePickerWrapper
    showClearDates
    startDatePlaceholderText="入住日期"
    endDatePlaceholderText="退房日期"
    monthFormat="yyyy[年]MMMM"
    phrases={{
        closeDatePicker: '关闭',
        clearDates: '清除日期',
    }}
    locale="zh-CN"
/>

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.9%
  • SCSS 0.1%