react-datepicker icon indicating copy to clipboard operation
react-datepicker copied to clipboard

dateFormat does not reflect the chosen locale

Open alex-piccione opened this issue 3 years ago • 2 comments

Describe the bug When a locale is passed the dateFormat should reflect that locale and not using the default MM/dd/yyyy.

To Reproduce

  1. Use the provided example for setting the locale:
import { registerLocale, setDefaultLocale } from  "react-datepicker";
import es from 'date-fns/locale/es';
registerLocale('es', es)

<DatePicker
  locale="es"
/>
  1. Look at the date in the textfield, it is in the format MM/dd/yyyy

Expected behavior The date in the textbox should be in the format dd/MM/yyyy

Screenshots

image

Desktop (please complete the following information):

  • OS: Windows
  • Browser Chrome
  • Version latest

Smartphone (please complete the following information):

Not tested on smartphone.

Additional context Sandbox: https://codesandbox.io/s/es-locale-forked-0d4ck

alex-piccione avatar Jan 22 '22 09:01 alex-piccione

#3375

Use dateFormat prop with eg. 'P' for Long localized date 'p' for Long localized time 'Pp' for Combination of date and time

mkaivanto avatar Feb 10 '22 08:02 mkaivanto

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 13 '22 06:08 stale[bot]

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 10 days.

github-actions[bot] avatar Jun 21 '24 01:06 github-actions[bot]

This issue was closed because it has been stalled for 10 days with no activity.

github-actions[bot] avatar Jul 01 '24 01:07 github-actions[bot]