Repository navigation
Add DateTimeRange object for datetime ranges - #2857
Merged
Merged
Conversation
A CarbonPeriod-based range that keeps the time of day for both ends, for binding the datetime picker's range mode with wire:model. The range's timezone travels in the synth metadata so it survives requests. Co-Authored-By: Claude Opus 5.5 <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.
The scenario
Flux Pro is adding a datetime picker with a range mode. Range values need to round-trip through Livewire with their times intact.
The problem
Flux\DateRangeonly stores dates. Its synth serializesY-m-d, so binding it to a datetime range drops the times.The solution
This adds
Flux\DateTimeRange, aCarbonPeriodsubclass likeDateRange, plus a Livewire synth that serializes both ends asY-m-d\TH:i(the format the datetime picker and nativedatetime-localinputs use).null, and unsetting either end clears it.unwrapForValidationexposesstart/endstrings forrange.startstyle rules.whereBetween()like anyCarbonPeriod.Flux Pro PR: https://github.com/livewire/flux-pro/pull/588
Docs PR: https://github.com/livewire/flux-docs/pull/244
Verification
set,unset, whole-object hydrate, null/partial values, validation unwrap)DateTimeRangeproperty (pre-filled and empty)🤖 Generated with Claude Code