Skip to content

Add split range picker via rangeEnd() (RFC 0001)#153

Merged
coolsam726 merged 6 commits into
mainfrom
feature/range-end-field
Jun 14, 2026
Merged

Add split range picker via rangeEnd() (RFC 0001)#153
coolsam726 merged 6 commits into
mainfrom
feature/range-end-field

Conversation

@coolsam726

@coolsam726 coolsam726 commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds RFC 0001 and ->rangeEnd('ends_at') so one range picker reads/writes separate start/end model attributes
  • Supports datetime ranges with ->time() and custom formats; end times are preserved on save
  • Sorts inverted same-day datetime selections chronologically in JS and PHP so the earlier time always becomes the start
  • Expands rangeEnd hydration, sync, and dehydration tests to 100% coverage (151 tests)

RFC

Closes RFC 0001.

API

Flatpickr::make('starts_at')
    ->rangePicker()
    ->rangeEnd('ends_at')
    ->time()
    ->format('Y-m-d H:i');

Default single-field array behaviour is unchanged when rangeEnd() is omitted.

Test plan

  • vendor/bin/pest --coverage --min=96 — 151 tests pass, 100% coverage
  • Open a form with ->rangePicker()->rangeEnd('ends_at')->time(), select a datetime range, save, and confirm both columns persist with correct times
  • Select same-day inverted times (e.g. 6:30am then 6:10am) and confirm the picker/state reorder to 6:10am → 6:30am
  • Edit an existing record and confirm the picker shows the saved range

Introduce rangeEnd() so one range picker can hydrate, sync, and dehydrate separate start and end model attributes while keeping single-field array behaviour as the default.
Document datetime range usage, add tests for split datetime dehydration, and build split regex from format tokens so time components parse correctly.
Build range wire state from selectedDates in JS, avoid brute-force split for partial ranges when syncing ends_at, and add tests that assert end times are preserved.
Skip the state watcher feedback loop after picker updates and preserve range date order when enableTime is on, so end-before-start selections are not swapped by flatpickr.setDate().
Chronologically normalize range picker state in JS and PHP so same-day
end-before-start selections save correctly, and add schema-mount tests
that restore 100% coverage for the rangeEnd hydration and sync paths.
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (a7c23a5) to head (332a03b).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##                main      #153    +/-   ##
============================================
  Coverage     100.00%   100.00%            
- Complexity       293       354    +61     
============================================
  Files              6         6            
  Lines            698       823   +125     
============================================
+ Hits             698       823   +125     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coolsam726 coolsam726 merged commit 82e9a9c into main Jun 14, 2026
47 checks passed
@coolsam726 coolsam726 deleted the feature/range-end-field branch June 14, 2026 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants