Skip to content

Add DateFormat option for European #1651

@slaxnasa

Description

@slaxnasa

✨ Feature request – Expose date format in Datepicker

The underlying flowbite-datepicker library already supports a format option, but flowbite-react does not currently expose it.

This makes it impossible to display dates in common European formats (e.g. dd/MM/yyyy) without hacks or custom inputs.

It would be very useful to have an API like:

<Datepicker dateFormat="dd/MM/yyyy" />




🎯 Use case

In many locales (France, Belgium, Spain, etc.), the standard date format is:

dd/MM/yyyy

Currently, developers must either:
		Replace the input manually, or
		Use another datepicker library just for formatting

This defeats the purpose of using flowbite-react as a complete UI solution.



🛠 Proposed implementation
	1.	Add a new optional prop to the Datepicker component:

export interface DatepickerProps {
  // existing props...
  dateFormat?: string; // e.g. "dd/MM/yyyy"
}

	2.	Pass this prop to the internal options:

const options = {
  language,
  minDate,
  maxDate,
  weekStart,
  autoHide,
  ...(dateFormat && { format: dateFormat }),
};

	3.	Use these options when instantiating the underlying datepicker:

const instance = new FlowbiteDatepicker(inputRef.current, options);




💡 Why this works

flowbite-datepicker already supports the format option.
This change simply exposes an existing capability in flowbite-react without:
		Breaking existing APIs
		Introducing new dependencies
		Changing default behavior

It would significantly improve usability for non-US locales.



I can provide a PR if this approach is acceptable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions