Skip to main content

j01.daterangepicker

    DateRange picker widget for `z3c.form`. Wraps Air Datepicker v3.6.0
    (MIT, Timur Borodin).
    
    Two normal `zope.schema.Date` fields are paired into a single
    range-picker UI through the `setUpDateRangePickerWidget` factory.
    Standard `z3c.form` data managers handle the write-back -- no
    custom data manager required.
    
    ## Usage
    
    ```python
    from j01.daterangepicker import setUpDateRangePickerWidget
    
    class MyForm(form.Form):
        fields = field.Fields(IMySchema).select(
            'startDate', 'endDate')
    
        widgetFactories = {
            'startDate': setUpDateRangePickerWidget(
                'startDate', 'endDate'),
            'endDate':   setUpDateRangePickerWidget(
                'startDate', 'endDate'),
        }
    ```
    
    Both factory calls use the same `fromName`/`toName` arguments;
    the widget detects on its own which side it is (primary or
    secondary) by comparing `field.__name__` to `fromName`.
    
    Optional min/max constraints and custom validator:
    
    ```python
    setUpDateRangePickerWidget(
        'startDate', 'endDate',
        minDate=datetime.date.today(),
        maxDate=datetime.date(2030, 12, 31),
        validator=myCustomValidator)
    ```
    
    The widget exposes `validateRange(fromValue, toValue)` with an
    in-built `fromValue <= toValue` check; a custom `validator` callable
    is called in addition. Wire the check into the consumer's action
    handler after `extractData()`.
    
    ## Vendor library
    
    Air Datepicker v3.6.0 files are vendored under `cdn/js/` and
    `cdn/css/`. See `LICENSE.txt` for the upstream MIT licence text.
    The locale files in `cdn/js/air-datepicker.locale.<lang>.js` are
    hand-rewrapped from the upstream CJS modules into browser-IIFE form
    so they can be loaded via a regular `<script>` tag without a
    bundler; the locale data itself is verbatim from upstream.
    
    
    =======
    CHANGES
    =======
    
    0.5.1 (2026-05-20)
    ------------------
    
    - Fix: Inline init script bailed out on initial page parse because
      the secondary widget's hidden `_to` input was rendered *after*
      the primary widget's `<script>` block in document order, so
      `document.getElementById(toInputId)` returned null and the
      `if (!toEl) return;` guard tripped -- Air Datepicker was never
      attached. Init now waits for `DOMContentLoaded` when the document
      is still loading, falls back to `setTimeout(init, 0)` otherwise.
    
    
    0.5.0 (2026-05-20)
    ------------------
    
    - Initial release. DateRange picker widget for z3c.form wrapping
      Air Datepicker v3.6.0 (MIT, Timur Borodin).
    - Pair-mode wiring through `setUpDateRangePickerWidget`: two
      `zope.schema.Date` fields share one picker UI, standard
      z3c.form data managers write back.
    - ISO-8601 (`YYYY-MM-DD`) on the wire; locale-formatted display
      string driven by the standard `z3c.form` `IDate` converter.
    - Vendored Air Datepicker library files in `cdn/{js,css}/` for
      consumer-side resource registration. Locale files (de/en/fr/it)
      rewrapped as browser IIFEs that attach to
      `window.AirDatepickerLocales[lang]`.
    - Optional `m01.mongo` IMongoDate adapter (zcml:condition).

Release files for j01.daterangepicker 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for j01.daterangepicker 0.5.1
File Size Uploaded
j01_daterangepicker-0.5.1.tar.gz 37.2 kB Details

Release files / j01_daterangepicker-0.5.1.tar.gz

Download URL j01_daterangepicker-0.5.1.tar.gz
Size 37.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4a6e04a00585f659d936d33e0440330f184b4b131087a3eb860782dc05eada78
BLAKE2b-256 checksum
How to use checksums
ac8482419e882be3972e75d1da284f594aed40c74d918837dd079a6d8dd4f648
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release history Release notifications | RSS feed

This release

0.5.1 This release

1 release file

0.5.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page