uselessdev / datepicker

A simple datepicker with Chakra-UI and date-fns

Home Page:https://uselessdev-datepicker.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use the Locale on date-fns functions

tomchentw opened this issue · comments

Issue

#38 is a good demonstration for this bug. If I change locale to the one that has Monday as their first day of the week, the calendar will not respect that. Eg. Italian locale https://github.com/date-fns/date-fns/blob/v2.25.0/src/locale/it/index.js

JPEG-1

Has an options.weekStartsOn = 1. With #38, it gives:

JPEG-2

Where Dom (domenica) is Sunday in Italian and Lun (lunedì) is Monday in Italina

Solution

Whenever date-fns functions are used, they should given the locale object.
https://date-fns.org/v2.28.0/docs/Locale

I will see if I could submit a PR for this. Thank you