[6.x] Fix date-only index fieldtype shifting across timezones#14602
Merged
jasonvarga merged 2 commits into6.xfrom May 4, 2026
Merged
[6.x] Fix date-only index fieldtype shifting across timezones#14602jasonvarga merged 2 commits into6.xfrom
jasonvarga merged 2 commits into6.xfrom
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a date field's format has no time component,
Date::preProcessIndexDate()sends the value to the index fieldtype as aY-m-dstring.new Date("2025-12-25")parses that as UTC midnight, andIntl.DateTimeFormatthen renders it in the local browser timezone — so anyone west of UTC saw the previous day in listings.This passes
timeZone: 'UTC'to the formatter whenformat_has_timeis false, so the day stays put. The condition hinges onformat_has_timeonly (matching the data shape produced by the backend); theformat_has_time=true, time_enabled=falsecase still has a real ISO moment baked in, so local TZ formatting remains correct there.Test plan
npx vitest run resources/js/tests/components/fieldtypes/DateIndexFieldtype.test.js— addeddate-only value does not shift across timezonesanddate-only range does not shift across timezones; updated existing TZ-localization tests to setformat_has_time: trueso they continue exercising the with-time TZ shift.🤖 Generated with Claude Code