This was done for D7 in #728026: Add Views Filter handler for Open/Closed (today/now/soon). I would like to see it added for D8 as well.

I do have two concerns though: 1) Timezone handling, 2) Cache-ing.

Were those addressed for D7?

Comments

mstef created an issue. See original summary.

ChristopheDG’s picture

Would be great to have this functionality!

johnv’s picture

Component: Code » Views integration
johnv’s picture

Component: Views integration » Integrating Views
SocialNicheGuru’s picture

Yes. I want to show which stores are open. A views filter would be great

tuthanh’s picture

Subscribe

johnv’s picture

johnv’s picture

Assigned: Unassigned » johnv
XTaz’s picture

Subscribe

johnv’s picture

Please add a use case, so i can work on it.
Patches are greatly appreciated.

johnv’s picture

Title: [D8] Add Views Filter handler for Open/Closed (today/now/soon) » Add Views Filter handler for Open/Closed (today/now/soon) [D8]
johnv’s picture

Issue summary: View changes
AlfTheCat’s picture

Yes, much needed. For a collection of stores that do instant delivery, and a nearby businesses directory, there needs to be a way to filter on open / closed.

johnv’s picture

Assigned: johnv » Unassigned

  • johnv committed bee56065 on 8.x-1.x
    Issue #2828834: Add Views Filter handler for Open/Closed (now/soon/never...
johnv’s picture

Title: Add Views Filter handler for Open/Closed (today/now/soon) [D8] » Add Views Filter handler for Open/Closed (today/now/soon/never)
Version: 8.x-1.x-dev » 8.x-1.11
Issue summary: View changes
Status: Active » Fixed

It took a while...

Above commit adds an open/closed status filter with the following options:

  • ANY => '- Any -'
  • OPEN => 'Open now'
  • CLOSED => ''Temporarily closed' (so, no differentiation yet between soon/today/tomorrow )
  • NEVER => 'Permanently closed'

It was tested for authorized and anonymous users (for page_cache module).
The filtering is in the Render phase, so no worries about the caching. Each time a view is refreshed, the status is recalculated.

Note: Timezone handling is not handled at all in this module, despite efforts. That totally depends on the entity's address and user's timezone. A hook is provided, though.

Status: Fixed » Closed (fixed)

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