Problem/Motivation

While developing a datetime Better Exposed Filter (#3500976: Build a DatetimePicker plugin to also handle time ), I noticed that the default offset value was not applied when no value was submitted.

I tried to use hooks like hook_views_pre_view(), hook_views_pre_execute() but acceptExposedInput() was always overriding the value $handler->value['value'] to null

Steps to reproduce

Proposed resolution

If the filter was not submitted but has default offset values, apply them so backends receive resolved dates.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3578444

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

macsim created an issue. See original summary.

macsim’s picture

Status: Active » Needs review
macsim’s picture

Issue summary: View changes
smustgrave’s picture

Status: Needs review » Needs work

Thanks for reporting and opening with test coverage!

Left a small comment on the MR.

macsim’s picture

Status: Needs work » Needs review

Thanks for the review.

I applied your suggestion

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative, +Bug Smash Initiative

Thanks feedback appears to be addressed and much simpler

lendude’s picture

Status: Reviewed & tested by the community » Needs work

Looks good, just left one minor thing to improve the test coverage

macsim’s picture

Status: Needs work » Needs review

I added a node beyond the max offset to check that point

lendude’s picture

Status: Needs review » Reviewed & tested by the community

Thank you! Back to RTBC

alexpott’s picture

Version: main » 11.3.x-dev
Status: Reviewed & tested by the community » Fixed

Nice find and fix. I ran some tests to ensure that the new code didn't generate PHP warnings about things not being set - all looks good.

Committed and pushed ec09b79130e to main and 3e792f7bcda to 11.x and 9a9b46d95c7 to 11.3.x. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • alexpott committed 9a9b46d9 on 11.3.x
    fix: #3578444 Date filter doesn't apply default offset values
    
    By:...

  • alexpott committed 3e792f7b on 11.x
    fix: #3578444 Date filter doesn't apply default offset values
    
    By:...

  • alexpott committed ec09b791 on main
    fix: #3578444 Date filter doesn't apply default offset values
    
    By:...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.