Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Filament Daterangepicker Filter Laravel Package

malzariey/filament-daterangepicker-filter

Alpine.js-powered date range picker and filter for Filament. Pick day/month/year ranges with presets, optional time selection (12/24h), keyboard input validation, localization, accessibility, and modal/slide-over friendly dropdown teleport. Matches Filament v4 UI.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Pros:

    • Filament Integration: Seamlessly extends Filament’s existing query builder and filter system, leveraging its modular architecture. Aligns with Filament’s declarative UI patterns (e.g., Table, Form).
    • Date Range Filtering: Fills a niche gap in Filament’s native filtering capabilities, offering a user-friendly date range picker (via daterangepicker.js) without reinventing core logic.
    • MIT License: Permissive licensing enables easy adoption in proprietary/commercial projects.
    • Recent Activity: Last release in 2026 suggests ongoing maintenance (assuming no forks are stale).
  • Cons:

    • Tight Coupling to Filament: Limited utility outside Filament’s ecosystem (e.g., Livewire, Inertia, or vanilla Laravel apps). Requires Filament v3+ (check compatibility with your version).
    • JavaScript Dependency: Relies on daterangepicker.js (v3+), adding frontend complexity. May need bundling (Vite, Laravel Mix) or CDN inclusion.
    • No Backend Logic: Purely a frontend filter—does not modify query building or database interactions (handled by Filament’s QueryBuilder).
    • Limited Customization: Documentation (if any) may lack advanced use cases (e.g., multi-column filters, custom date formats).

Integration Feasibility

  • Filament Version Compatibility:
    • Verify support for your Filament version (e.g., v3.x). Check for breaking changes in recent Filament updates (e.g., query builder API shifts).
    • Example: If using Filament v3.1+, confirm the package hasn’t deprecated methods like addFilter().
  • Frontend Setup:
    • Requires daterangepicker.js (likely via npm/yarn or CDN). Ensure your Laravel app’s build pipeline (Vite/Webpack) can handle it.
    • Potential conflicts with existing date libraries (e.g., Flatpickr, jQuery UI).
  • Query Builder Alignment:
    • Filament’s QueryBuilder must support the date range syntax generated by the filter (e.g., between, >=, <=). Test edge cases like null values or invalid ranges.
  • Localization:
    • If your app uses non-English locales, ensure the date picker’s labels/tooltips are translatable (may need manual overrides).

Technical Risk

Risk Area Severity Mitigation
Filament Version Mismatch High Pin to a specific Filament version in composer.json or fork if needed.
JavaScript Conflicts Medium Isolate daterangepicker in a micro-frontend or namespace CSS/JS.
Poor Documentation Medium Test with a minimal Filament table; expect trial-and-error for edge cases.
Lack of Backend Validation Low Add server-side validation for date ranges if business logic requires it.
Performance with Large Data Low Benchmark with 10K+ records; Filament’s query builder may need optimization.

Key Questions

  1. Filament Version:
    • What version of Filament are you using? Does the package explicitly support it?
  2. Query Builder Customization:
    • Can the package’s generated SQL be overridden for complex date logic (e.g., time zones, custom fields)?
  3. Frontend Build Process:
    • How is your Laravel app’s JavaScript bundled (Vite, Mix, Inertia)? Will daterangepicker integrate smoothly?
  4. Localization Needs:
    • Does the package support RTL languages or custom date formats (e.g., DD/MM/YYYY)?
  5. Testing Coverage:
    • Are there PHPUnit tests for the package? If not, how will you test edge cases (e.g., invalid ranges)?
  6. Alternatives:
    • Have you considered Filament’s native DateFilter or third-party packages like spatie/laravel-filament-resources for similar functionality?

Integration Approach

Stack Fit

  • Ideal Use Cases:
    • Filament-based admin panels requiring date-range filtering (e.g., analytics dashboards, CRM records, event management).
    • Projects already using daterangepicker.js or willing to adopt it for consistency.
  • Anti-Patterns:
    • Avoid if you need server-side date parsing (e.g., time zones, fiscal calendars)—this is frontend-only.
    • Not suitable for non-Filament Laravel apps (e.g., Livewire standalone, Inertia with custom UI).

Migration Path

  1. Prerequisites:

    • Ensure Filament is installed and configured. If not, follow Filament’s docs.
    • Install the package:
      composer require malzariey/filament-daterangepicker-filter
      
    • Publish assets (if needed) and include daterangepicker.css/js in your layout or Vite config.
  2. Implementation Steps:

    • Basic Usage:
      use Malzariey\FilamentDaterangepickerFilter\Filters\DateRangeFilter;
      
      $table->filters([
          DateRangeFilter::make('created_at')
              ->label('Creation Date'),
      ]);
      
    • Customization:
      • Override default labels, date formats, or add presets (e.g., "Last 7 Days").
      • Extend the filter class for custom logic (e.g., disable certain ranges).
    • Testing:
      • Verify the filter appears in the UI and correctly modifies the query.
      • Test with null/empty ranges and edge dates (e.g., 2026-01-01 to 2026-01-01).
  3. Advanced Integration:

    • Multi-Column Filters: Combine with Filament’s FilterGroup for complex queries.
    • Dynamic Ranges: Use JavaScript to update the filter based on user actions (e.g., select a month from a dropdown).
    • AJAX Debouncing: If filtering large datasets, implement debouncing to avoid excessive queries.

Compatibility

  • Filament Plugins:
    • Conflicts unlikely if the package follows Filament’s plugin system. Test with other Filament plugins (e.g., filament-spatie-laravel-medialibrary).
  • Laravel Versions:
    • Check composer.json for Laravel version constraints (likely 9.x/10.x). Use laravel-shift/doctrine or similar if on an older version.
  • Browser Support:
    • daterangepicker.js supports modern browsers. Test in your target environments (e.g., Safari, Firefox).

Sequencing

  1. Phase 1: Proof of Concept (1–2 days)

    • Install the package in a staging environment.
    • Add to a non-critical table (e.g., test data).
    • Validate UI and query behavior.
  2. Phase 2: Core Implementation (3–5 days)

    • Integrate into production tables.
    • Customize labels, presets, and error handling.
    • Write unit tests for filter logic.
  3. Phase 3: Optimization (1–2 days)

    • Profile query performance with large datasets.
    • Optimize JavaScript loading (e.g., lazy-load daterangepicker).
    • Document edge cases for support.
  4. Phase 4: Rollout

    • Deploy to a subset of users for feedback.
    • Monitor for JavaScript errors or query timeouts.

Operational Impact

Maintenance

  • Proactive Tasks:
    • Dependency Updates: Monitor malzariey/filament-daterangepicker-filter and daterangepicker.js for security patches.
    • Filament Updates: Test the package after major Filament releases (e.g., v3.x to v4.0).
    • Localization: Maintain custom translations if using non-English locales.
  • Reactive Tasks:
    • JavaScript Issues: Debug conflicts with other libraries (e.g., jQuery, Alpine.js).
    • Query Performance: Optimize if filters cause slow queries (e.g., add database indexes).

Support

  • Troubleshooting:
    • Common Issues:
      • Filter not appearing: Check Filament’s filters() method syntax.
      • JavaScript errors: Verify daterangepicker is loaded and namespaced correctly.
      • Incorrect queries: Inspect the generated SQL (use Laravel’s query log).
    • Debugging Tools:
      • Browser DevTools to inspect daterangepicker initialization.
      • Filament’s dd($table->getFilters()) to debug filter configuration.
  • Documentation Gaps:
    • Create internal runbooks for:
      • Customizing the date picker’s appearance.
      • Handling time zones in queries.
      • Extending the filter for non-standard use cases.

Scaling

  • Performance:
    • Frontend: daterangepicker is lightweight (~50KB minified). No significant impact on page load.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
monarobase/country-list
nasirkhan/laravel-sharekit
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity