Skip to content

Do not show years that are after end date #456

Closed
@Downchuck

Description

@Downchuck

When setting start date and end date fields, the year selector will show years that are after the end date, where all selections are disabled.

These can of course just be handled by startYear and endYear manually.

    const currentDate = new Date();
    const eighteenYearsAgo = new Date(currentDate.getFullYear() - 18, currentDate.getMonth(), currentDate.getDate());
    const longAgo = new Date(currentDate.getFullYear() - 123, currentDate.getMonth(), currentDate.getDate());

             <DatePickerInput
                locale="en"
                label="Birthdate"
                inputMode="start"
                validRange={{startDate: longAgo, endDate: eighteenYearsAgo}}
              />

On that same note - the default pick will be outside of the valid range when date is supplied as undefined.

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