appannie / react-infinite-calendar

✨ Infinite scrolling date-picker built with React, with localization, range selection, themes, keyboard support, and more.
MIT License
20 stars 16 forks source link

locale does not work #55

Open victornikitin opened 1 month ago

victornikitin commented 1 month ago

Hello. Trying to pass locale, but headerFormat and month names are shown as "Invalid date".

Code:

          <InfiniteCalendar
            width={300}
            height={300}
            locale={{
              locale: require('@appannie/react-infinite-calendar/node_modules/date-fns/locale/fr'),
              headerFormat: moment().localeData().longDateFormat("L")
            }}
            value={value}
          />

How to pass it correctly? Or may be even change api of locale attribute to momemt?

victornikitin commented 1 month ago

Found solution, but still have problems with translate.

Code:

          <InfiniteCalendar
            width={300}
            height={300}
            locale={{
              locale: require('@appannie/react-infinite-calendar/node_modules/date-fns/locale/fr').default,
              headerFormat: "d MMM"
            }}
            value={value}
          />

Month names in calendar are translated. But in header is still not.