mozilla-mobile / prox

[INACTIVE] A search and discovery app for the "here & now". We're experimenting with ideas on mobile that can better surface content from the open web.
https://wiki.mozilla.org/New_Mobile_Experience
Mozilla Public License 2.0
22 stars 12 forks source link

Closes #598: always show closed places if we have open times #607

Closed thebnich closed 7 years ago

thebnich commented 7 years ago

The behavior we want here is to: 1) Show the opening time if the event is later today, 2) Show "tomorrow" if the event is tomorrow, and 3) Show the day of week if the event is any later.

It was kinda hard to wrap my head around our existing OpenHours API, but I think this works. Since our open hours are stored and partitioned by day, and since getOpeningTimes only returns time on the day of the date provided, this iterates through each day until we get a result. Note that the first date we iterate over is today including the time since we don't want to show events from earlier in the day; other dates we iterate over use 0:00 so that getOpeningTimes doesn't skip it.

This also changes getNextOpeningPeriod from > to >= so we include future events that start at midnight.