wintercms / wintercms/winter

Daterange filter uses invalid max timestamp for MySQL compatibility

Open
#1,418 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
1.5k
Forks
246
Avg merge
19h 2m
Merged PRs (30d)
7

Description

Winter CMS Build

dev-develop

PHP Version

8.4

Database engine

MySQL/MariaDB

Plugins installed

No response

Issue description

When using the backend Filter widget for date or daterange fields, if only the start date is selected, the filter automatically fills the end date with 2999-12-31 23:59:59.
This value exceeds the maximum allowed for MySQL TIMESTAMP fields (2038-01-19 03:14:07), causing SQL errors or data truncation.

Steps to replicate

Steps to Reproduce

  1. Go to any backend list with a date filter.
  2. Select only the start date, leaving the end date empty.
  3. Apply the filter and export or query the data.
  4. The filter value for the end date will be 2999-12-31 23:59:59.

Expected Behavior

The filter should use the maximum MySQL TIMESTAMP value (2038-01-19 03:14:07) when the end date is not set, to ensure compatibility.

Actual Behavior
The filter uses 2999-12-31 23:59:59, which is not compatible with MySQL TIMESTAMP fields.

Workaround

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the backend Filter widget's date and daterange handling, following the path used when only a start date is selected. Confirm where 2999-12-31 23:59:59 is produced, change the fallback to the stated MySQL-compatible maximum, and verify that filtering or exporting no longer causes SQL errors or data truncation.

Written by the indexing model from the issue text.

Assessment

Tech stack
mariadb, mysql, php
Domain
backend, database
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.