Jump to content

Custom date search filters don't persist form value through refresh


Go to solution Solved by Marc,

Recommended Posts

Posted (edited)

To reproduce:

  • Go to the full search page, /search/
  • Apply a date filter (either created or updated), with value set to "Custom" and a start and/or end date
    Could contain: Page, Text, File
  • Enter a search term, and submit
  • Refresh the page (or click one of the "Didn't find what you were looking for" suggested filters)
  • Expand the search filter options again, and observe that the supplied date filter has been cleared
    Could contain: Page, Text, File, Invoice, Document
  • Edit the search term, then submit the search request again, and observe that the date filter is no longer being applied

This is because in core/html/front/search/filters.phtml, lines 193/197/219/223, you're directly stringifying the current value, which is a \IPS\DateTime

{$elements['search_tab_content']['updatedDateCustom']->value['end']}

which results in a non-ISO8601-compliant timestamp like "11/03/22 12:00  AM" (rather than 2022-11-03). You probably need to do something like you already have in the regular Date form element template

value="{{if $value instanceof \IPS\DateTime}}{$value->format('Y-m-d')}{{else}}{$value}{{endif}}"

 

(This was reported to me by a user using Firefox, and reproed also in Firefox. It's possible that other browsers tolerate the invalid values, I haven't checked, but doing so would not be standards compliant).

Edited by Colonel_mortis
Posted

Thank you for bringing this issue to our attention! I can confirm this should be further reviewed and I have logged an internal bug report for our development team to investigate and address as necessary, in a future maintenance release.

 

  • 4 weeks later...
  • Solution
Posted

This item has now been resolved on the latest 4.7.5 release of the platform. If you are experiencing issues once you have upgraded, please let us know.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...