Bug 39593 - Show library hours in OPAC
Summary: Show library hours in OPAC
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-04-09 17:24 UTC by Christopher Brannon
Modified: 2025-04-15 16:16 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 39593: Show library hours in OPAC (4.54 KB, patch)
2025-04-10 12:08 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 39593: Show library hours in OPAC (4.59 KB, patch)
2025-04-15 15:14 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 39593: Show library hours in OPAC (4.65 KB, patch)
2025-04-15 15:56 UTC, Alexander Wagner
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Brannon 2025-04-09 17:24:36 UTC
It would be great if there were a way to display the library hours defined in libraries on the OPAC library listing.  Preferably in the desired format (24hr or 12hr).

I am not finding any information about whether this is possible yet.
Comment 1 Owen Leonard 2025-04-10 11:51:14 UTC
Bug 39593: Show branch hours in OPAC
Comment 2 Owen Leonard 2025-04-10 12:08:24 UTC
Created attachment 180765 [details] [review]
Bug 39593: Show library hours in OPAC

This patch adds library hours to the information display on the OPAC's
libraries page.

To test, apply the patch and add hours to one or more libraries if
necessary (Administration -> Libraries).

- In the OPAC, go to the Libraries page.
- The libraries you added hours for should show a table of days with
  opening and closing times.
- If both opening and closing times on a day are empty the table shows
  "Closed".
- Libraries without hours should not show the table of hours.

Sponsored-by: Athens County Public Libraries
Comment 3 Christopher Brannon 2025-04-10 16:43:34 UTC
This works, but are you able to address the option of time format mentioned in the bug?
Comment 4 Alexander Wagner 2025-04-11 11:33:23 UTC
Works on my end and I'd almost be ready to sign it off.

Opening hours are defined with the library. They display just fine. (Except for the format issue outlined by Christopher. We could live with that.)

Closing days, holidays etc however, defined via Tools / Calendar are not (yet?) taken into account.

I think those would be quite relevant for the user. Shouldn't they end up here as well? 

Say, the regular opening hours for Friday is 09:00 .. 14:00, and they show on the libraries page. But just this week Friday, April 18th the library is closed due to a public holiday in my region.

PS: It is a bit strange from the Koha admin UI, that those two, IMHO closely related things live so far apart. But that's a different story.
Comment 5 Michaela Sieber 2025-04-15 09:58:08 UTC
(In reply to Alexander Wagner from comment #4)
> Works on my end and I'd almost be ready to sign it off.
> 
> Opening hours are defined with the library. They display just fine. (Except
> for the format issue outlined by Christopher. We could live with that.)
> 
> Closing days, holidays etc however, defined via Tools / Calendar are not
> (yet?) taken into account.
> 
> I think those would be quite relevant for the user. Shouldn't they end up
> here as well? 
> 
> Say, the regular opening hours for Friday is 09:00 .. 14:00, and they show
> on the libraries page. But just this week Friday, April 18th the library is
> closed due to a public holiday in my region.
> 
> PS: It is a bit strange from the Koha admin UI, that those two, IMHO closely
> related things live so far apart. But that's a different story.

Hi Alexander,

the calender in the tools is relevant for calculating due dates, overdue notices and fines.
Although our library is open 24/7 on 365 days per year we have holidays in our calender because we don't want to have due dates on weekends or to send out overdue letters on christmas ;-)
But thats why we would not display them in the opac, they have nothing to do with our opening hours.
Comment 6 Alexander Wagner 2025-04-15 10:33:53 UTC
> the calender in the tools is relevant for calculating due dates, overdue notices and fines.

Sure. I understood that as well. (Still I wonder why the two are so far away from each other.)

I was mainly wondering if for the implementation done here it was a conscious decision to hook up with the per library opening hours only, or if the holiday calendar was just missed out.

If holidays should be neglected in this display I'd work myself through the sign-off ASAP. :)

> our library is open 24/7 on 365 days per year

Same here as well. However, you will not find any library staff on the major holidays. It might be quite helpful for the patron to hint on this fact. One may also argue that "we are open 24/7" does not require any opening hours and their display in the first place ;)

BTW: I intend give our opening hours as the staffed hours. Not as "in principle the building is not locked" hours.
Comment 7 Owen Leonard 2025-04-15 12:09:40 UTC
(In reply to Christopher Brannon from comment #3)
> This works, but are you able to address the option of time format mentioned
> in the bug?

In my testing the time format was correct according to the system preference. Can you describe what you're seeing?

(In reply to Alexander Wagner from comment #4)
> Closing days, holidays etc however, defined via Tools / Calendar are not
> (yet?) taken into account.

The patch re-uses code which is used in the staff interface for displaying library hours in library administration. That view doesn't take holidays into account.
Comment 8 Christopher Brannon 2025-04-15 15:13:20 UTC
(In reply to Owen Leonard from comment #7)
> (In reply to Christopher Brannon from comment #3)
> > This works, but are you able to address the option of time format mentioned
> > in the bug?
> 
> In my testing the time format was correct according to the system
> preference. Can you describe what you're seeing?

Well, how about that.  I didn't even know there was a setting for that.  Is it supposed to show 12 hour time with a leading zero?

> (In reply to Alexander Wagner from comment #4)
> > Closing days, holidays etc however, defined via Tools / Calendar are not
> > (yet?) taken into account.
> 
> The patch re-uses code which is used in the staff interface for displaying
> library hours in library administration. That view doesn't take holidays
> into account.

I do think at some time the calendars need to be folded into the branches, and holidays need to be considered for showing on page, even if in a separate holiday table.  But that is for another bug.

I also think that there needs to be some marriage between the hours and the calendar.  It is weird to define the hours one place, then having to define closed days somewhere else.  It is redundant.  We should be able to define regular hours, and then define holiday exceptions.  Its all a bit muddy and needs cleaning up.  But again, that is for another bug.

I will sign off on this.  Thanks for your help on this!
Comment 9 Biblibre Sandboxes 2025-04-15 15:14:03 UTC
Created attachment 180974 [details] [review]
Bug 39593: Show library hours in OPAC

This patch adds library hours to the information display on the OPAC's
libraries page.

To test, apply the patch and add hours to one or more libraries if
necessary (Administration -> Libraries).

- In the OPAC, go to the Libraries page.
- The libraries you added hours for should show a table of days with
  opening and closing times.
- If both opening and closing times on a day are empty the table shows
  "Closed".
- Libraries without hours should not show the table of hours.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Christopher <cbrannon@cdalibrary.org>
Comment 10 Christopher Brannon 2025-04-15 15:14:43 UTC
Works as expected.
Comment 11 Alexander Wagner 2025-04-15 15:56:20 UTC
Created attachment 180976 [details] [review]
Bug 39593: Show library hours in OPAC

This patch adds library hours to the information display on the OPAC's
libraries page.

To test, apply the patch and add hours to one or more libraries if
necessary (Administration -> Libraries).

- In the OPAC, go to the Libraries page.
- The libraries you added hours for should show a table of days with
  opening and closing times.
- If both opening and closing times on a day are empty the table shows
  "Closed".
- Libraries without hours should not show the table of hours.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Christopher <cbrannon@cdalibrary.org>
Signed-off-by: Alexander Wagner <alexander.wagner@desy.de>
Comment 12 Alexander Wagner 2025-04-15 15:59:10 UTC
Note: the diff shows some "magics" that might pose a miss-handling in non-english OPAC displays. IOW I am unsure if the literal `Sunday` gets translated, or a literal `Opening time`.  (I don't know enough of the tt-handling yet, especially wrt NLS.)
Comment 13 Katrin Fischer 2025-04-15 16:16:05 UTC
Hi Alexander, I have checked the patch - everything in there is translatable. Our tools parse the HTML for strings. Constructs like <span>Sunday</span> etc. will be picked up by the tools.