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

Datepicker Format to allow more date formats #2318

Open
agaktr opened this issue Feb 26, 2024 · 1 comment
Open

Datepicker Format to allow more date formats #2318

agaktr opened this issue Feb 26, 2024 · 1 comment

Comments

@agaktr
Copy link

agaktr commented Feb 26, 2024

Currently the datepicker has a "dd-mm-yyyy" format range and variations of this string format.

We should allow formats of different use cases

ex.
Instead of 26/02/2024 you may want to use a more readable date format of Monday 26 February 2024 or something else.

we should allow all the date strings to be compatible with the datepicker

@iprzybysz
Copy link
Contributor

Hi @agaktr, our Datepicker component provides a variety of date format combinations, also as you mentioned Monday 26 February 2024.

Check out this code:

<div
  class="relative mb-3"
  data-te-datepicker-init
  data-te-format="dddd dd mmmm yyyy"
  data-te-input-wrapper-init>
  <input
    type="text"
    class="peer block min-h-[auto] w-full rounded border-0 bg-transparent px-3 py-[0.32rem] leading-[1.6] outline-none transition-all duration-200 ease-linear focus:placeholder:opacity-100 peer-focus:text-primary data-[te-input-state-active]:placeholder:opacity-100 motion-reduce:transition-none dark:text-neutral-200 dark:placeholder:text-neutral-200 dark:peer-focus:text-primary [&:not([data-te-input-placeholder-active])]:placeholder:opacity-0"
    placeholder="Select a date" />
  <label
    for="floatingInput"
    class="pointer-events-none absolute left-3 top-0 mb-0 max-w-[90%] origin-[0_0] truncate pt-[0.37rem] leading-[1.6] text-neutral-500 transition-all duration-200 ease-out peer-focus:-translate-y-[0.9rem] peer-focus:scale-[0.8] peer-focus:text-primary peer-data-[te-input-state-active]:-translate-y-[0.9rem] peer-data-[te-input-state-active]:scale-[0.8] motion-reduce:transition-none dark:text-neutral-200 dark:peer-focus:text-primary"
    >Select a date</label
  >
</div>

More information about date formats, you'll find in the Datepicker Documentation.

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

No branches or pull requests

2 participants