You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support ActiveAdmin 4 with native datetime-local inputs - #97
Adds ActiveAdmin 4 support. ActiveAdmin 4 has no jQuery or Sprockets, so on v4 the date_time_picker input and the date_time_range filter render native datetime-local fields (date for a date column) instead of the xdsoft picker. ActiveAdmin 3 behaviour and assets are unchanged.
Decisions not visible in the diff:
No JS or CSS on v4. ActiveAdmin 4 already styles native date inputs, including dark mode, so hosts install nothing.
The v4 filter copies ActiveAdmin 4's DateRangeInput markup (.filters-form-input-group) and adds back the filter_date_time_range wrapper class so active_admin_date_range_preset can find the pair.
Values are ISO (YYYY-MM-DDTHH:MM). A Ransack formatter swaps the T for a space, but only for untyped ransackers, which compare as strings.
min_date/max_date/step map to min/max/step. Other xdsoft options are ignored on v4, as the README now says.
New data-datetimepicker-* hooks on inputs and the range wrapper, on v3 and v4.
Gemspec widened to < 5.0.0.a, so ActiveAdmin 5 prereleases stay out. Minor release: nothing changes for v3 hosts.
Verified locally: full suite green on AA 3.5 and AA 4.0.0.beta23 (Rails 8.0, plus 8.1 on v4). CI matrix gains a 4.0.0.beta23 column.
AA=4.0.0.beta23 swaps Sprockets for Propshaft and importmap-rails, and the
test app is built per ActiveAdmin major. The xdsoft feature specs are tagged
aa: 3 since ActiveAdmin 4 pages load no jQuery.
Co-Authored-By: Clanker
ActiveAdmin 4 has no jQuery, and its date range filter renders date-only
fields. The form input and the range filter now emit datetime-local fields
with ISO values; a Ransack formatter turns the ISO "T" into a space for
ransackers without a type, which compare as strings.
Co-Authored-By: Clanker
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The datetime-local max_date fallback uses midnight, incorrectly rejecting later times on the intended inclusive final day, and the spec currently expects that incorrect boundary.
XDSoft's maxDate allows the whole last day; midnight blocked every later
time. Time options now render in the app's zone, and the README notes that
the browser enforces min, max and step on submit.
Co-Authored-By: Clanker
Stored strings that are not ISO no longer render blank and get wiped on
save, and a Time minDate starts at midnight like xdsoft's.
Co-Authored-By: Clanker
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Combined date and datetime limits can discard stricter bounds, while offset-bearing string limits are not normalized to the application time zone, causing incorrect browser validation.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Combine date and datetime limits using the stricter bound
lib/active_admin_datetimepicker/base.rb:94
When both date-level and datetime-level limits are configured, || discards the date-level limit even if it is stricter. For example, min_date: '2024-01-20' with min_date_time: '2024-01-10 12:00' allows January 15 despite the date restriction; maximum limits have the same issue. Preserve both constraints by taking the later minimum and the earlier maximum.
Normalize offset-bearing limit strings to the application time zone
lib/active_admin_datetimepicker/base.rb:119
Offset-bearing strings lose their offset without being converted to the application zone: in a UTC app, min_date_time: '2024-01-20T13:00:00+01:00' renders min="2024-01-20T13:00" instead of 12:00, unlike an equivalent Time/DateTime limit. This causes browser validation to reject valid times or accept times beyond a maximum. Parse strings in Time.zone so explicit offsets are normalized while offsetless values remain local wall times.
# Relative xdsoft values such as "+3D" have no native equivalent.
return nil if strict && !value.to_s.match?(%r{\A\d{4}[-/]\d{1,2}[-/]\d{1,2}})
value = DateTime.parse(value.to_s)
This branch has not been deployed
No deployments
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
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 ActiveAdmin 4 support. ActiveAdmin 4 has no jQuery or Sprockets, so on v4 the
date_time_pickerinput and thedate_time_rangefilter render nativedatetime-localfields (datefor a date column) instead of the xdsoft picker. ActiveAdmin 3 behaviour and assets are unchanged.Decisions not visible in the diff:
DateRangeInputmarkup (.filters-form-input-group) and adds back thefilter_date_time_rangewrapper class so active_admin_date_range_preset can find the pair.YYYY-MM-DDTHH:MM). A Ransack formatter swaps theTfor a space, but only for untyped ransackers, which compare as strings.min_date/max_date/stepmap tomin/max/step. Other xdsoft options are ignored on v4, as the README now says.data-datetimepicker-*hooks on inputs and the range wrapper, on v3 and v4.< 5.0.0.a, so ActiveAdmin 5 prereleases stay out. Minor release: nothing changes for v3 hosts.Verified locally: full suite green on AA 3.5 and AA 4.0.0.beta23 (Rails 8.0, plus 8.1 on v4). CI matrix gains a 4.0.0.beta23 column.