You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered an issue when trying to set a very high expiration date for API tokens. Specifically, when choosing a year far in the future (e.g., 2304), an exception is thrown:
It seems MySQL is unable to handle dates beyond a certain range in the datetime column.
Expected Behavior
The system should handle far-future dates gracefully by rejecting them with a proper error message or by automatically capping the maximum allowed date.
Actual Behavior
An unhandled SQL exception is thrown, causing the operation to fail.
Steps to Reproduce
Set an expiration date for an API token with a very high year (e.g., 2304).
Save the token to the database.
Observe the SQL exception being thrown.
Suggestion
How can we enforce a maximum expiration date, such as capping it to 50 years from now? This would ensure compatibility with MySQL's date limitations and provide a clear constraint.
Thank you in advance for your help!
The text was updated successfully, but these errors were encountered:
Hi everyone,
I encountered an issue when trying to set a very high expiration date for API tokens. Specifically, when choosing a year far in the future (e.g., 2304), an exception is thrown:
SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '2304-01-01 19:13:32' for column 'expires_at' at row 1 (Connection: mysql, SQL: insert into
personal_access_tokens
(name
,token
,abilities
,expires_at
,tokenable_id
,tokenable_type
,updated_at
,created_at
) values (rwerew, 6ec27502fc48fe9f43f23df4d204326748d446a4f201b11809cf9f5ddecf698d, ["read"], 2304-01-01 19:13:32, 01jj27svz5tyank2kzxf45zhyp, App\Models\User, 2025-01-20 19:13:32, 2025-01-20 19:13:32))It seems MySQL is unable to handle dates beyond a certain range in the datetime column.
Expected Behavior
Actual Behavior
Steps to Reproduce
Suggestion
How can we enforce a maximum expiration date, such as capping it to 50 years from now? This would ensure compatibility with MySQL's date limitations and provide a clear constraint.
Thank you in advance for your help!
The text was updated successfully, but these errors were encountered: