themesberg / flowbite

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

Incorrect Type for autoSelectToday in DatePickerOptions #916

Closed andreweberle closed 6 days ago

andreweberle commented 6 days ago

Describe the bug The autoSelectToday property in the DatePickerOptions object is incorrectly documented as a boolean when it is actually defined as a number in the codebase.

To Reproduce Steps to reproduce the behavior:

  1. Initialize a DatePickerOptions object with autoSelectToday set to a number, e.g., 1 or 0 to replicate a boolean
  2. Attempt to use the datepicker functionality relying on autoSelectToday.
  3. Observe that autoSelectToday does not behave as expected based on the documentation.

const datePickerOptions = { defaultDatepickerId: null, autohide: false, format: 'dd/mm/yyyy', maxDate: null, minDate: null, orientation: 'bottom-right', buttons: false, autoSelectToday: 1, title: null, language: 'en', rangePicker: false, } as DatepickerOptions;

Expected behavior autoSelectToday should be documented and typed consistently as a boolean in the DatePickerOptions interface, allowing it to correctly indicate whether today's date should be preselected.

zoltanszogyenyi commented 6 days ago

Hey @andreweberle,

As the parent library uses 0 and 1 instead of false and true it will most likely stay with numbers.

I'll update the docs from boolean now so that there is no confusion here.

Cheers, Zoltan

andreweberle commented 6 days ago

@zoltanszogyenyi No worries at all mate :)