Repository navigation
Add page objects and fix the end of datetime ranges - #26
Merged
Merged
Conversation
A preset with date_to_human_readable wrote 23:59 into a _lteq_datetime_picker input, and that predicate is a strict <, so the last minute of the range was dropped. Such inputs now end at the next day's 00:00. Co-Authored-By: Clanker
Co-Authored-By: Clanker
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues affecting the optional page-object integration or datetime range boundary fix.
No open issues 🎉
What changed in this PR
Adds optional page objects for interacting with date-range presets in tests and fixes datetime ranges that previously omitted the final minute when using active_admin_datetimepicker’s strict end predicate.
Changes:
- Adds
choose_presetandrangehelpers through an optional Active Admin 4 page-object integration. - Preserves next-day midnight for exclusive datetime ends while retaining existing date-input behavior.
- Adds regression coverage and documents the integration and boundary fix.
| File | Description |
|---|---|
vendor/assets/javascripts/active_admin_date_range_preset.js |
Keeps exclusive datetime range ends at next-day midnight. |
spec/page_objects_spec.rb |
Tests preset selection, returned ranges, and missing-title errors. |
spec/datetimepicker_markup_spec.rb |
Tests human-readable datetime and date range boundaries. |
README.md |
Documents optional page objects and exclusive-end behavior. |
lib/active_admin_date_range_preset/page_objects/presets.rb |
Implements preset selection and range-reading helpers. |
lib/active_admin_date_range_preset/page_objects.rb |
Loads the optional integration, checks compatibility, and registers selectors. |
Gemfile |
Adds a pinned test-only page-object dependency for Active Admin 4. |
CHANGELOG.md |
Records the page-object addition and datetime boundary fix. |
Review effort: Balanced
Merged
senid231
added a commit
that referenced
this pull request
Dec 1, 2026
Minor: #26 adds optional page objects and fixes the end of datetime ranges. The CHANGELOG heading moves from Unreleased to 1.1.0. Co-Authored-By: Clanker
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.
Adds optional page objects (
require "active_admin_date_range_preset/page_objects") and fixes a preset that dropped the last minute of a datetime range.The bug: with
date_to_human_readable: true, a preset wrote23:59as the end. The datetimepicker's_lteq_datetime_pickerpredicate is a strict<, so the range missed its last minute. Inputs with that predicate now end at the next day's00:00. Settingstep="1"with23:59:59would still drop the last second. Other inputs keep23:59:59and23:59, asnative_inputs_specexpects.choose_presetfinds the menu from the session, because the menu is appended to<body>. A missing title raisesCapybara::ElementNotFound, listing the presets on offer. The page objects gem is a test-group dependency withrequire: false; the gemspec is unchanged.Verified: the suite passes on ActiveAdmin 4.0.0.beta23 (50 examples) and 3.5 (47 examples).