Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow date input to setup a custom formattedValue #6930

Open
1 task done
ritxi opened this issue Sep 3, 2024 · 1 comment
Open
1 task done

Allow date input to setup a custom formattedValue #6930

ritxi opened this issue Sep 3, 2024 · 1 comment

Comments

@ritxi
Copy link

ritxi commented Sep 3, 2024

Description

As a developer using Carbon I want to be able to define a custom formattedValue for date-input/date-range. The application I'm working on allows to setup prefered date format. It would be nice to be able pass this format to the date-input/date-range.

Suggested solution

Add a prop to overide default smart behaviour based on locale.

const [state, setState] = useState("04/04/2019");
  const setValue = (ev: DateChangeEvent) => {
    setState(ev.target.value.formattedValue); // 04-04-2019
  };
  return <DateInput label="Date" name="date-input" value={state} onChange={setValue} customFormat="DD-MM-yyyy" />;

Demo URL

No response

Alternatives

No response

Additional context

No response

Confidentiality

  • I confirm there is no confidential or commercially sensitive information included.
@ritxi ritxi added Enhancement triage Triage Required labels Sep 3, 2024
@nineteen88
Copy link
Contributor

FE-6797

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants