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

Date field cannot accept older dates #3556

Open
robinsowell opened this issue Jun 22, 2023 · 1 comment · Fixed by #3911
Open

Date field cannot accept older dates #3556

robinsowell opened this issue Jun 22, 2023 · 1 comment · Fixed by #3911
Labels
Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on.

Comments

@robinsowell
Copy link
Contributor

If you put a date with year 1901 or older in a date field- including entry date- it won't validate and you can't save it.

Summarizing: You can't have dates prior to 1901 or after 2038. This is the size limitation of int data types that we use for date columns.

2 possible solutions:

  • allow changing column type from int to bigint same as we do for RTE fields. This is quick and easy, because we have the code already
  • start using datetime column instead of int for dates. This is IMO the most proper solution and this how it should have been done 15 years ago, but making the change will be more involved.
@robinsowell robinsowell added the Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on. label Jun 22, 2023
@intoeetive
Copy link
Contributor

I can confirm this issue. You can't have dates prior to 1901 or after 2038. This is the size limitation of int data types that we use for date columns.
As a temporary solution, the user can change the column type to bigint in db and remove this part from validation in ft.date.php : or (is_numeric($data) && ($data > 2147483647 or $data < -2147483647)
We don't have validation rule like this for entry_date, but the same problem exists for any date - we're using int everywhere
I think that we need to get it fixed and I think there are 2 possible solutions:

  • allow changing column type from int to bigint same as we do for RTE fields. This is quick and easy, because we have the code already
  • start using datetime column instead of int for dates. This is IMO the most proper solution and this how it should have been done 15 years ago, but making the change will be a pain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on.
Projects
None yet
2 participants