themesberg / flowbite

Open-source UI component library and front-end development framework based on Tailwind CSS
https://flowbite.com
MIT License
7.55k stars 715 forks source link

Datepicker not working as expected #642

Closed CNRP closed 1 month ago

CNRP commented 1 year ago

So i've got an input like this:

<input datepicker datepicker-autohide datepicker-format="dd/mm/yyyy" name="moving_date" id="moving-date" type="text" placeholder="Select move date">

const datepickerEl = document.getElementById('moving-date');
new Datepicker(datepickerEl, {
    // options
});

The date picker works, however the datepicker-autohide & datepicker-format="dd/mm/yyyy" do not change the input at all. Any additional variable I add inside the input tag, has no effect on the actual date picker, it initialises like it is a default configuration.

All I really need to work is having the date format as the UK date format dd/mm/yyyy.

I'm using laravel10 & tailwind in the setup. I may have configured something wrong, but I'm not sure because it works, just the extra parameters don't set. Should I be adding them inside the options somehow instead?

Any help would be greatly appreciated!

Fludem commented 10 months ago

Pass it into the constructor, it takes a config object

 const dateRangePickerEl = document.getElementById('moving-date');
                        new dateRangePicker(dateRangePickerEl, {
                            autohide: true,
                            format: "dd/mm/yyyy"
                        });

Sorry this is late, also using Laravel & Livewire and was looking for documentation :P

raaydr commented 9 months ago

Pass it into the constructor, it takes a config object

const dateRangePickerEl = document.getElementById('moving-date');
                       new dateRangePicker(dateRangePickerEl, {
                           autohide: true,
                           format: "dd/mm/yyyy"
                       });

Sorry this is late, also using Laravel & Livewire and was looking for documentation :P

still not working for me

Fludem commented 9 months ago

Pass it into the constructor, it takes a config object

const dateRangePickerEl = document.getElementById('moving-date');
                       new dateRangePicker(dateRangePickerEl, {
                           autohide: true,
                           format: "dd/mm/yyyy"
                       });

Sorry this is late, also using Laravel & Livewire and was looking for documentation :P

still not working for me

Are you seeing any console errors?

I had to put this in a component in Githubissues.

  • Githubissues is a development platform for aggregating issues.