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: minDate is inclusive, maxDate is exclusive #923

Open
chrispymm opened this issue Nov 14, 2024 · 0 comments · May be fixed by #929
Open

Datepicker: minDate is inclusive, maxDate is exclusive #923

chrispymm opened this issue Nov 14, 2024 · 0 comments · May be fixed by #929
Labels
bug A task that fixes something that isn't working

Comments

@chrispymm
Copy link
Contributor

This may not technically be a bug, but it is inconsistent and non-intuitive. The minDate and maxDate options to the datepicker component behave differently.

{{ mojDatePicker({
  id: "date",
  name: "date",
  label: {
      text: "Date"
  },
  hint: { 
    text: "For example, 17/5/2024."
  },
  value: "10/04/2025",
  minDate: "04/04/2025",
  maxDate: "21/4/2025"
}) }}

With the config above setting a mindate of 04/04/2025 and a maxDate of 21/4/2025

  • 4/4/2025 will be disabled and non-selectable
  • 20/4/2025 will be available for selection

It appears from the code in the component that the intention was for the minDate to be exclusive (as it uses < not <=) however a weird quirk of date comparison appears to be causing it to treat the provided minDate as excluded.

This would be a breaking change to fix

@chrispymm chrispymm added the bug A task that fixes something that isn't working label Nov 15, 2024
chrispymm added a commit that referenced this issue Nov 15, 2024
This PR makes minDate behaviour match maxDate, and allows the date provided in the option to be
selected.

BREAKING CHANGE: The date provided to the component via the minDate option is now selectable by
users. If you are using the mindate functionality, you will need to adjust the dates you pass into
the component to ensure the correct dates are included/excluded.

fix #923
@chrispymm chrispymm linked a pull request Nov 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A task that fixes something that isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant