themesberg / flowbite-svelte

Official Svelte components built for Flowbite and Tailwind CSS
https://flowbite-svelte.com
MIT License
2.02k stars 239 forks source link

[Feature] Datepicker (Experimental) #29

Open shinokada opened 2 years ago

shinokada commented 2 years ago

Experimental

Date picker component.

reaper-king commented 1 year ago

Hi, using datepicker in sveltekit , breaking my app, the browser console shows follwing error Uncaught (in promise) DOMException: Failed to execute 'setAttribute' on 'Element': '' is not a valid attribute name.

oyenmwen commented 1 year ago

Hi, using datepicker in sveltekit , breaking my app, the browser console shows follwing error Uncaught (in promise) DOMException: Failed to execute 'setAttribute' on 'Element': '' is not a valid attribute name.

In addition to getting this error, when using range, the calendar popup just does not show up at all. And with no browser console error either

Suyashtnt commented 1 year ago

It would be nice to add a way to exclude dates from the datepicker. This can be used to e.g block users for preventing holiday dates for a delivery or not book already booked dates

DrewRidley commented 1 year ago

There is also no way to collect the value selected by the user, or any events that you can even use.

fabiot21 commented 1 year ago

There is also no way to collect the value selected by the user, or any events that you can even use.

Any known workaround to get the value from user?

outranker commented 11 months ago

Hi, using datepicker in sveltekit , breaking my app, the browser console shows follwing error Uncaught (in promise) DOMException: Failed to execute 'setAttribute' on 'Element': '' is not a valid attribute name.

@reaper-king were you able to find a solution to this? i'm facing the same issue currently

outranker commented 11 months ago

anyone having this error: Uncaught (in promise) DOMException: Failed to execute 'setAttribute' on 'Element': '' is not a valid attribute name.

Datepicker component expects attribute prop to be non falsy value. meaning you need to pass something to it. the problem resolves

ex:

<Datepicker
    attribute="aria-label"
    placeholder="some placeholder"
    for="some_for"
    datepickerFormat="dd/mm/yyyy"
    datepickerTitle="some title"
/>
sachinaugi07 commented 8 months ago

anyone having this error: Uncaught (in promise) DOMException: Failed to execute 'setAttribute' on 'Element': '' is not a valid attribute name.

Datepicker component expects attribute prop to be non falsy value. meaning you need to pass something to it. the problem resolves

ex:

<Datepicker
  attribute="aria-label"
  placeholder="some placeholder"
  for="some_for"
  datepickerFormat="dd/mm/yyyy"
  datepickerTitle="some title"
/>

This did resolve the issue but when I click on the input field the date dropdown does not pop up.

outranker commented 8 months ago

anyone having this error: Uncaught (in promise) DOMException: Failed to execute 'setAttribute' on 'Element': '' is not a valid attribute name. Datepicker component expects attribute prop to be non falsy value. meaning you need to pass something to it. the problem resolves ex:

<Datepicker
    attribute="aria-label"
    placeholder="some placeholder"
    for="some_for"
    datepickerFormat="dd/mm/yyyy"
    datepickerTitle="some title"
/>

This did resolve the issue but when I click on the input field the date dropdown does not pop up.

that's odd. it's working fine for me. tho i have one more prop defined which is datepickerButtons set to false. you will need to show some code and any error message that might exist in order for others to help you out with this

RichardJohnn commented 8 months ago

If you use Datepicker in a form and submit it, you can read the values that way, at least with range. The inputs are named 'start' and 'end'


[...]
  function handleSubmit(event) {
    event.preventDefault();
    console.log(event.target.elements['start'].value);
    console.log(event.target.elements['end'].value);
  }
</script>

<form on:submit={handleSubmit}>
  <Datepicker 
      range 
      datepickerFormat="yyyy-mm-dd" 
      datepickerButtons=true />
  <button type="submit">
    Submit
  </button>
</form>