Repository navigation
[#1109] Stored 'date_recur' values as written and rejected a record with no 'timezone' or a non-storage date. - #1111
Merged
Merged
Conversation
…ith no 'timezone' or a date outside the storage format.
… inheritance diagram.
AlexSkrypnyk
enabled auto-merge (squash)
October 23, 2026 06:32
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1111 +/- ##
=======================================
Coverage 99.23% 99.23%
=======================================
Files 180 180
Lines 9592 9596 +4
=======================================
+ Hits 9519 9523 +4
Misses 73 73 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Closes #1109
Summary
DateRecurHandlerstores adate_recurrecord'svalueandend_valueexactly as the.featuretable gives them again, the way 3.14 did through DrupalDriver'sDateRecurHandler. date_recur reads those columns as UTC and computes occurrences in the record'stimezone, so a table row gives the stored UTC values plus thetimezone, the same columns the database holds.#1056 made the handler read
valueandend_valueas local times in the record'stimezoneand convert them to UTC. It was matching a docblock inherited from DrupalDriver, which claimed the stored values were local times, when the code had always stored them as written. Any 3.14 row with a non-UTCtimezone, such as2024-01-01T20:00:00withAustralia/Melbourne, saved fine on 4.x but landed infield_rec_schedule_valueas2024-01-01T09:00:00, so every occurrence moved by the timezone offset and nothing failed.After this merges, a 3.14
.featurefile saves the same database values on 4.x. Instead of a silent shift, the handler now rejects 2 mistakes at the step: a record with a date but notimezonefails withDate recur field record has a date but no "timezone"., and a date outside the storage format, such as2025-01-01T09:00:00Zorrelative:+1 day, fails with a message naming the format. A record with no dates still clears the field,rruleandinfiniteare still relayed, and no other field handler changes.Before / After
Changes
date_recurhandlersrc/Backend/Drupal/Core/Field/DateRecurHandler.phpextendsAbstractHandleragain instead ofDatetimeHandler, anddoExpand()relaysvalueandend_valueas given, turning an empty one intoNULL.assertRecordTimezone()rejects a record with a date and an empty or missingtimezone, and keeps theinvalid timezone "..."message for a name PHP doesn't recognize.assertStorageFormat()parses each date with the storage format of the field'sdatetime_type(Y-m-d\TH:i:s, orY-m-dfor a date-only field) and rejects a value that doesn't parse or doesn't format back identically, which covers offsets,Z, a space separator,relative:and out-of-range dates such as2025-02-30.Tests
DateRecurHandlerTestdrops the site timezone container setup and covers relayed records, empty dates, every rejection and the date-only format (31 cases).DateRecurHandlerKernelTestsaves stored UTC values and asserts date_recur computes the occurrences at 09:00 and 17:00 Sydney time, and asserts that a record without atimezonefails atcreateEntity().Docs
MIGRATION.mdreplaces thedate_recurconversion entry with the 3 failure messages a 3.14 project can now hit.src/Backend/Drupal/Core/Field/README.mddescribes the relay and the 2 checks.docs/content/architecture/class-inheritance.drawioand its 2 SVGs moveDateRecurHandlerfrom underDatetimeHandlerinto the "extend AbstractHandler directly" box.Summary
DateRecurHandlernow extendsAbstractHandlerand relaysvalueandend_valuewithout timezone conversion. Empty date values becomeNULL.rruleandinfiniteare still relayed.Linked issue
Issue
#1109requests an opt-in storage-value mode while keeping the existing conversion behavior as the default. This change makes relaying values the default, so it does not preserve the issue’s requested default behavior.Contribution rules
No step definitions changed. The step definition rules in
CONTRIBUTING.mddo not apply to these changes.Validation
Test results were not provided.