Datepicker min and max year

System Information
  • Strapi Version: 4.0.7
  • Operating System: macOS
  • Database: Postgresql
  • Node Version: 16
  • NPM Version: 8.1.2
  • Yarn Version: N/A

Hello, i’m trying to use the Datepicker field to registrer birth dates, but it only allows numbers of years until 50 numbers back.
So, now in 2022 it allows from 1972 to 2072 and I need to register 1955 por example.

I found the limit in https://github.com/strapi/design-system/blob/main/packages/strapi-design-system/src/DatePicker/utils/getYears.js

export const getYears = () => {
  const currentYear = new Date().getFullYear();
  return Array(101)
    .fill(null)
    .map((_, index) => currentYear - 50 + index);
};

Is there a way to change this value? at least as a workarround?

Thanks!

1 Like

Are there any updates on this?
The only solution right now is to store it via an API.
Because the date-input-field doesn’t allow textual changes - with the GUI it is impossible to save dates earlier then 50 years.

1 Like

No pretty solution…
I drop the calendar and changed the datatype to text and check the format with a regex formula.

1 Like