themesberg / themesberg/flowbite-react

Add DateFormat option for European

Open
#1,651 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.1k
Forks
506
PR merge metrics
No merged PRs in 30d

Description

✨ 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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Datepicker component and inspect how its internal options are assembled before the FlowbiteDatepicker instance is created. Trace the existing language, minDate, maxDate, weekStart, and autoHide options, then verify that the optional dateFormat is passed through as the underlying format option without changing defaults.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.