aboveyunhai / chakra-dayzed-datepicker

Chakra UI + Dayzed = datepicker
https://aboveyunhai.github.io/chakra-dayzed-datepicker/
MIT License
222 stars 46 forks source link

Display short name of days as the input label/value #39

Closed cedrvanh closed 1 year ago

cedrvanh commented 1 year ago

I'm trying to display the short names of days as the label/value of the input, but it doesn't seem to work. If I look at the formatting docs of date-fns I should be able to pass 'ddd' to dateFormat of the config object. Doing this just prepends a 0 to the current day for each 'd' added.

Code:

<SingleDatepicker
    ...props
    configs={{
        dateFormat: 'ddd - dd/MM',
        monthNames: MonthNamesShort,
        dayNames: WeekdayNamesShort,
    }}
/>

Formatting like this gives me this result:

Screenshot 2023-01-19 at 12 33 47

The expected result would be: Thu - 19/01

aboveyunhai commented 1 year ago

Based on date-fns, you are looking for EEE - dd/MM .

cedrvanh commented 1 year ago

@aboveyunhai you're right! thank you