Skip to content

v5.3.0: BSDateRangePicker without JQuery - #17

Merged
gmpassos merged 2 commits into
masterfrom
feat/daterangepicker-no-jquery
Oct 8, 2026
Merged

gmpassos merged 2 commits into
masterfrom
feat/daterangepicker-no-jquery

Conversation

@gmpassos

@gmpassos gmpassos commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

BSDateRangePicker no longer needs JQuery, so this package no longer loads it (only an explicit JQuery.load() does).

  • Bundled date range picker (lib/components/daterangepicker): now vanilla-datetimerange-picker at commit 32608b3 (MIT): Dan Grossman's daterangepicker 3.1 (the version bundled until now) with JQuery replaced by DOM calls. Same options (startDate, endDate, timePicker, timePicker24Hour, timePickerIncrement, ranges, locale), callback and CSS selectors. It still uses Moment.
    • The open picker (ranges, calendars, time picker) renders pixel-identical to the previous one (headless Chrome screenshots compared).
  • Local patches (documented in the file header, checked by the consistency test):
    • the 2 previous ones: minute rounded to timePickerIncrement; callback with a single array.
    • new: clickApply/clickCancel dispatch the apply/cancel events on the picker element, as the original did (the port used e.target, failing when called without an event, e.g. picker.clickApply()).
    • new: remove() removes the container from the document and the window resize listener, as the original did (the port only dropped its reference, and added the listener again).
  • BSDateRangePicker: load doesn't load JQuery; creates new DateRangePicker(element, config, callback); new jsPicker (the JS instance); a new render removes the previous JS picker (its container used to be left in document.body).
  • README: JQuery and the date range picker in the bundled libraries; new See also section with the related projects (Bones_UI, Bones_API, DOM_Builder, DOM_Tools, Swiss_Knife, Intl_Messages, AMDJS, Web_Utils) and the bundled libraries.
  • CHANGELOG / pubspec.yaml: 5.3.0.

Review fixes (9ccbfdf)

  • daterangepicker.js outsideClick: "inside the picker" by element identity (contains), as in the original; the port built a CSS selector from the element tag and classes (div.form-control), so a click on another picker field kept the open one open (two pickers shown).
  • remove(): also sets isShowing = false.
  • BSDateRangePicker: the JS picker is also removed on clear and dispose (not only on a new render), deferred to a microtask so a render triggered by the picker callback (onChange → refresh) doesn't remove it while it's still inside hide().
  • render: if daterangepicker.js failed to load, only the date text (no TypeError).
  • Not changed: dataset options parsing and the [data-toggle=dropdown] hook of the port (not used by BSDateRangePicker).

Tests

  • New bones_ui_bootstrap_daterangepicker_test.dart (JQuery never loaded, two pickers in the page): loads without JQuery, JS selection calls back into Dart, opens on click, a click on the other picker field closes the open one, a click inside keeps it open, a new render or clear removes the JS picker, a render from onChange while applying completes the apply.
  • Integration tests use BSDateRangePicker.jsPicker instead of JQuery data (selection, cancel, ranges, minute rounding all still pass).
  • Consistency: the local patches, and no JQuery in daterangepicker.js.
  • dart test -p vm: 32 passed. dart test -p chrome: 73 passed. dart analyze, dependency_validator: clean.

🤖 Generated with Claude Code

gmpassos and others added 2 commits October 8, 2026 00:34
- Bundled date range picker: vanilla-datetimerange-picker (commit
  32608b3), Dan Grossman's daterangepicker 3.1 without JQuery, with the 2
  previous local patches plus: apply/cancel events on the picker element
  and remove() removing the container and the resize listener (as in the
  original).
- BSDateRangePicker: doesn't load JQuery; new DateRangePicker(...); new
  jsPicker; a new render removes the previous JS picker.
- README: bundled libraries, new See also section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- daterangepicker.js outsideClick: inside the picker by element identity,
  as in the original (the port matched any element with the same tag and
  classes, e.g. another picker field, keeping two pickers open).
- remove(): also sets isShowing = false.
- The JS picker is removed on render, clear and dispose, deferred (a
  render from the picker callback no longer breaks it while applying).
- render: only the date text if DateRangePicker isn't loaded.
- Tests: two pickers in the page, clear, render from onChange while
  applying.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gmpassos
gmpassos merged commit 2a25aec into master Oct 8, 2026
1 check passed
@gmpassos
gmpassos deleted the feat/daterangepicker-no-jquery branch October 8, 2026 03:48
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.

1 participant