Skip to content

Datepicker should accept minDate, maxDate props #2961

Open

Description

@anujsingla

Datepicker should accept minDate, maxDate props.
Currently, we can not set minDate, maxDate value in the props.

minDate - The minimum date that the user can select. It will ensure that no earlier date is selected.
maxDate - The maximum date that the user can select. It will ensure that no later date is selected.

Example - https://reactdatepicker.com/#example-specific-date-range

Activity

  1. abusarah-tech commented on Sep 5, 2021

    @abusarah-tech

    The components are meant to follow the SLDS design patterns according to their website it does not offer such functionality so I am not sure how they proceed with extra features.

  2. jcro21 commented on Jan 18, 2022

    @jcro21
    Contributor

    You can use dateDisabled to achieve that. For example the below will disable dates prior to current day, and additionally disable the current day if it's after 4pm:

    <Datepicker
      {...props} // etc
      dateDisabled={({ date }) => {
        const now = new Date();
        date.setHours(16, 0, 0, 0);
        return date < now;
      }}
    />
  3. stale commented on Apr 18, 2022

    @stale

    This issue has been automatically marked as stale, because it has not had recent activity. It will be closed if no further activity occurs. Maintainers are responsible for tech debt and project health. This is most likely a new components or component feature request. Please submit a pull request for or request feedback on this feature. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions