Implement date_filter integration

Created on 2 June 2025, 5 months ago

Implement date_filter β†’ integration.
When module is enabled, make sure filter is the date_filter widget.

✨ Feature request
Status

Active

Version

3.1

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia VladimirAus Brisbane, Australia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @VladimirAus
  • Merge request !131Implement date_filter integration β†’ (Open) created by VladimirAus
  • πŸ‡¦πŸ‡ΊAustralia VladimirAus Brisbane, Australia
  • Pipeline finished with Success
    5 months ago
    Total: 464s
    #512327
  • πŸ‡ΊπŸ‡ΈUnited States apmsooner

    I like this feature however, I don't think this is gonna work depending on date_filter module as there are implications around the field definition settings that aren't gonna match up with the sub-field settings. I'll look into just adding our own logic to bypass the need for that module. I think its always better if we can eliminate extra module dependencies.

  • πŸ‡ΊπŸ‡ΈUnited States apmsooner

    Somewhat related... I created a custom element here https://git.drupalcode.org/project/custom_field/-/blob/3.1.x/src/Element... to handle the "Date only" type. Core's generic datetime element is not semantically correct the way its themed for this case, a random h4 replaces the label which is just wrong. We can incorporate the correct custom_field specific element here also into views and can pass in the storage settings through the custom_field.views.inc. Even the core patch that is referenced in that date_filter module implies the date type from the field storage settings which wouldn't exist in same place there for a sub-field. It shouldn't be a whole lot of effort I don't think to replicate what they did in that module. I'll see if i can get something up to test out soon.

  • πŸ‡¦πŸ‡ΊAustralia VladimirAus Brisbane, Australia

    Thanks @apmsooner, however your comment is not clear on what needs more work.
    At the moment I have a clear issue where date fields are working date_filter but custom_field date fields are still plain text fields.

    My solution checks if the date_filter is enabled and complies with it's logic.
    If you have a specific testing scenario where it doesn't work, do let me know!

  • πŸ‡ΊπŸ‡ΈUnited States apmsooner

    Look here: https://git.drupalcode.org/project/date_filter/-/blob/1.0.x/src/Plugin/v...
    The date type for custom_field is not at the parent field storage settings and also there are dependencies on the datetime field plugins which we don't need that module and should rely on our own subfield plugins. For these reasons, I think we just need to create our own custom plugin for views that does the same thing. Make sense?

  • πŸ‡ΊπŸ‡ΈUnited States apmsooner

    I think we can copy this file: https://git.drupalcode.org/project/date_filter/-/blob/1.0.x/src/Plugin/v... into ours and just change the namespace and then modify https://git.drupalcode.org/project/custom_field/-/blob/3.1.x/src/Plugin/... and then we won't need anything from that module or core datetime module. You can see how the settings are already currently passed into our class currently so we don't need to call a get to field storage in the same way.

  • πŸ‡ΊπŸ‡ΈUnited States apmsooner

    Your patch was calling the DateTimestamp class from the module also. Shouldn't it have been the DateTime? I think thats maybe why its just working for you as is but i think the widget would/should be specific to the date type.

  • πŸ‡ΊπŸ‡ΈUnited States apmsooner

    I'm taking this on in a different branch. I discovered there's some better ways to handle this that improve the UX considerably and account for the different operators better. It will take a little bit to get it complete for testing but the goal on my end is to convert even the configuration fields to a date type for easier default settings. The date elements are a bit messy in Core and have some bugs to fully support better alternatives but as I've already created a custom date element, I can extend that to account for the fixes so we can have a cleaner UX in the following ways:

    • If exposed filter is date only, strip out the extra theming wrapper so we get just a very simple date input without fieldsets and such
    • If exposed filter is date + time, take advantage of the 'datetime-local' date element so we still get a simple input but better UX.

    There's a few core bugs related to 'datetime-local' that I can provide fixes for through my custom date element. All of this should lead to a better UX and be standardized across different admin themes. Stay tuned!

  • πŸ‡ΊπŸ‡ΈUnited States apmsooner

    apmsooner β†’ changed the visibility of the branch 3527922-implement-datefilter-integration to hidden.

  • πŸ‡ΊπŸ‡ΈUnited States apmsooner
  • πŸ‡ΊπŸ‡ΈUnited States apmsooner
  • Merge request !134Resolve #3527922 "Datefilter custom" β†’ (Merged) created by apmsooner
  • πŸ‡ΊπŸ‡ΈUnited States apmsooner

    @vladimiraus & anyone else willing to help with this review:

    Please check out my branch and test. There is no connection with the date_filter module and therefore unnecessary. Everything is handled directly in custom_field and there is some pretty advanced logic and various fixes unaccounted for in Core that make date form fields and views filters way more functional and visually appealing.

  • Pipeline finished with Skipped
    5 months ago
    #523759
  • Pipeline finished with Skipped
    5 months ago
    #523761
  • πŸ‡ΊπŸ‡ΈUnited States apmsooner
  • πŸ‡ΊπŸ‡ΈUnited States apmsooner
Production build 0.71.5 2024