Is it possible to "roll-up" the hours if a the hours are the same? For example, if the hours are fixed Monday - Friday 8am - 5pm. Instead of print a row for each day, can it display "Mon - Fri. 8:00am - 5:00pm"?

Comments

Ozeuss’s picture

It's possible as a separate widget, not as the current widget. I do consider it, but there's lack of time on my behalf. If anyone submits a patch, I'll be happy to commit.

recrit’s picture

Version: 6.x-1.0 » 6.x-1.x-dev
StatusFileSize
new5.4 KB

Attached patch:

version:
latest 6.x-1.x HEAD as of this post
files affected:
office_hours.module, office_hours.theme.inc
what it does:
provides a 'grouped' formatter for display days grouped by start and end hours.
unknown:
  • result on multiple time ranges for single day
  • time ranges that span over midnight - my initial thought is that it won't work
tested:
Limited testing has been done. Results from my simple test case:
formatter: default
Sunday:   Closed
Monday:  9:00 AM - 7:30 PM
Tuesday:  9:00 AM - 7:30 PM
Wednesday:  9:00 AM - 7:30 PM
Thursday:  9:00 AM - 7:30 PM
Friday:  9:00 AM - 7:30 PM
Saturday:  8:00 AM - 5:30 PM

formatter: grouped

Sun:   Closed
Mon - Fri:  9:00 AM - 7:30 PM
Sat:  8:00 AM - 5:30 PM
recrit’s picture

StatusFileSize
new5.44 KB

re-roll: moved the ordered weekdays to the end so output is correct for any 'first day of the week'

recrit’s picture

StatusFileSize
new5.63 KB

this re-roll removes dependency of group building on the 'first day of week'. Instead it indexes the groups on day name and then uses the properly ordered weekdays to output the groups.

Ozeuss’s picture

Status: Active » Fixed

Cool. works as expected.
committed.

jdlind38’s picture

@recrit This is exactly what I was hoping for. Thanks!

Status: Fixed » Closed (fixed)

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

johnv’s picture

Title: Roll-up hours » Roll-up hours / grouping of days in formatter
Version: 6.x-1.x-dev » 7.x-1.x-dev
Category: support » feature
Status: Closed (fixed) » Patch (to be ported)

This feature is not yet in D7.

skwashd’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new6.86 KB

I've ported recrit's patch to D7. I've added some additional CSS classes to help with applying different CSS to grouped hours.

johnv’s picture

Status: Needs review » Fixed
StatusFileSize
new9.72 KB

patch is heavily reworked and committed in f54fbb5

Status: Fixed » Closed (fixed)

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