How to present opening hours

Events happening in the community are now at Drupal community events on www.drupal.org.
xmacex's picture

Hiya. Do you have suggestions for storing and presenting opening hours in Drupal 7? This is quite a mundane and universal problem, so i'm absolutely sure this has been solved in many ways. There is the Opening Hours -module, which isn't available for D7 at this time though. The Danish ting.DING uses Office Hours, and present this information very well (see the Aarhus libraries f.ex.) in a list, on a map and for individual libraries.

Basically this information is HH:mm -type data, two for each day. One idea is to make a calendar event for every single day the library is open, from opening until closing time. That would generate a mad amount of events, but would be nice for special days.

mon 09:00 20:00
tue 09:00 20:00
wed 09:00 20:00
thu 09:00 20:00
fri 09:00 20:00
sat 12:00 18:00
sun 12:00 18:00

Because i want to use this data for Views (f.ex. to show libraries that are open at a user specified time or still open for at least one hour from now), i would like to make some nice data model for this, and not just list the times in a text field in human readable form.

Create 14 fields? Create 7 fields? Create n+1 events? Wait for Office Hours to be ported to D7? Many options... Any pointers anyone? I'll could start a wikipage about this.

Cheers.

Comments

This is how you enter it in ding.TING

xmacex's picture

Only local images are allowed.

Here is a screenshot of my local http://localhost/ding/?q=node/add/library and it shows how one defines library opening hours in the ting.DING, an opensource, Drupal based library website system. It utilizes the Office Hours -module and looks quite flexible to me. You can define an arbitrary amount of weeks to cope with those special weeks which have opening hours. The options in the Scope -dropdown are "Every week", "Odd numbered weeks", "Even numbered weeks", "Specific weeks" and "A range of weeks".

The simple way to do this is

highermath's picture

The simple way to do this is to create a library hours content type with days, hours and any other fields you want to show. You can then create a views block to display them.

This has the advantage of being very flexible: You can have different hours for different branches, identified by taxonomy (or ???); You can create a tabbed interface; etc.

I'll give that a go

xmacex's picture

Thanks highermath, i didn't think of a separate content type as i somehow intuitively thought that all info related to a library (a branch) should be defined in my "library" -content type. I already have a taxonomy for the libraries, so a block would work quite well i think. I'll work on in.

Here is a live example, if it helps

joseph.muennich's picture

Hi xmacek, If it is helpful, you can check out a live example from our development base: Homepage with today's hours in a block and Overview of default hours + scheduled exceptions

Today's hours block

tsaks's picture

Hi- was wondering how you did the 'Today's Hours' block on your website...?

Thanks!

Hours Block recipe

joseph.muennich's picture

Hi Tsaks,

Below is an outline of the steps I took to create flexible "Hours of Operation" functionality for Direct Communities' library package.

Step 1:
Create a vocabulary called "Hours Sets" and add terms for all locations, departments, and services that can have their own distinct hours of operation.

Step 2:
Create a CCK "hours of operation" content type with the following fields:

1) Title - Note: I reserved the title for administrative use to accomodate the admin's need to identify a defined set of hours -- example title: "Wednesday hours for the Eugene Branch".

2) Message (Text field) - Note: this is intended to give a short message -- such as "Wednesday's hours", "Today's hours", or "Closed for the Holiday")

3) Time (Date field) - Note: with repeat options enabled.

4) Explanation (Text field) - Note: intended to support an optional explanatory message -- such as "we will reopen on Monday when repairs are completed".

5) Priority (Integer field) - Note: I gave the priority field the following allowed set of values:
1|Hidden (For pre-created but inactive exceptions and notices)
2|Default hours of operation
3|Scheduled exception (overrides default hours of operation)
4|Notice (overrides both default hours and scheduled exceptions)

6) Hours Set (Content Taxonomy Field) - Note: this references the aforementioned defined taxonomy (step 1 above) listing all locations, departments, and services which can have their own distinct hours of operation.

Step 3:
Make some sample "hours" entries to display while fine tuning your "View".

Step 4:
Create a block display using Views with the following settings:
1) display limited to 1 item
2) filtered to include all hours entries for the current day.
3) exposed "Hours Set" filter to allow the visitor to select which set of hours to view (choosing between library branches in my case).
4) sort the results by descending priority so that the first item in the results set is the one with the highest priority. Since only one item is displayed, the following is true: Notices take priority over scheduled exceptions, scheduled exceptions take priority over default hours of operation, and default hours of operation show up when there are no special cases. Note: "Hidden" is available as an option (in the priority settings) to support pre-generation of emergency notices that can later be quickly enabled (by changing their priority from "hidden" to "notice".

Step 5:
Put the resulting block on any desired pages.

Step 6:
Enter your hours of operation (be careful when specifying default hours of operation that only one set of default hours is active for any given time period for each location / service).

I hope this helps. Contact me if you need some direct help getting this running for your example.

  • Joseph

Joseph Muennich
directcommunities.com
YourLibrarySite Developer


Hey Joseph- Thanks for the

tsaks's picture

Hey Joseph-

Thanks for the quick response and detailed tutorial!
I'll give it a shot and let you know if I run into any problems.

Thanks again!

Tarmo

I still can't figure out how

tinem's picture

I still can't figure out how I do it for Opening 24 hours hope someone can help, please?

I shall use it for my toiletmap http://beta.findtoilet.dk/ and if you don't write anything then it says closed but how does it say open? There will be a lot of toilets that have 24 hours opening so need it for that. This is for one toilet where I have used it http://beta.findtoilet.dk/content/under-r%C3%A5dhuspladsen-ved-ht-inform...

The options in the Scope -dropdown are "Every week", "Odd numbered weeks", "Even numbered weeks", "Specific weeks" and "A range of weeks".
Could someone please tell me how to use these, please? Can't figure out from looking in module and there are NO readme file explaining such things. A little guidance would have been great.

A D7 version of Office Hours is available

xmacex's picture

Hi, a Drupal 7 port of Office Hours has recently been published. I installed it today, and after patching it with patch <office_hours_theme.inc, it is now working and i can pick up the data from the content fields with Views. Hooray! :) Surely the patch is soon integrated into the release and manual patching will not be necessary.

How to show Opening 24 hours

tinem's picture

How to show Opening 24 hours for Drupal 6?

This discussion is in

highermath's picture

This discussion is in reference to the module Office Hours (misquoted as Opening Hours), which is available for Drupal 6.

Im using this module

New solution

targoo's picture

You can also use http://drupal.org/project/field_timetable which offer as a urge bonus support for view !!!

@targoo Would it be possible

tinem's picture

@targoo Would it be possible to see some sites where it's used, please?

I started using https://github.com/dingproject/drupal-office_hours but haven't played with it since but think a lot of changes has been made.

Live Site

New module opening hours

zorp's picture

There is a new module that the Ding library base use for future versions. It is called opening hours and can be found here: http://drupal.org/project/opening_hours

Aarhus library have been updated and use this module for opening hours, http://www.aakb.dk/biblioteker
(Place your mouse over opening hours marked with an asterisk *)

The new module is available for D6 and D7 and offer some advanced options for entering and displaying opening hours.

Thanks zorp, So are you

tinem's picture

Thanks zorp, So are you saying that https://github.com/dingproject/drupal-office_hours is not used by the libraries anymore and that they now use http://drupal.org/project/opening_hours instead and this should be easier to understand/use?

I'm not saying that office

zorp's picture

I'm not saying that office hours is'nt used anymore, there can be many libraries using it. Don't think everyone in the Ting community have updated to opening_hours yet. But Aarhus and Copenhagen have.

Opening hours is a refactor of office hours with a lot of added functionality. This is functionality that libraries in the ting community have requested. Some might be DK library specific but still the module is generic and can be installed and used on any site.

I do not say the module is easier to use, to be frank I have never seen the backend so got no clue. The fronted could use some design work wich the developer also have requested.

I can't help with the use of this module in anyway. I just wanted to inform about this new module

Opening Hours isn't usable

phette23's picture

Maybe I'm just missing something, but I installed the Opening Hours project from Drupal.org and couldn't get it anywhere close to working.
For starters, the dates are displayed European-style (e.g. 26/8 instead of 8/26) which would confuse my users. There is no global configuration for the module, only per-node settings. When I click the next or previous arrows to move to the next week, the week's times flash briefly before "Loading administrative interface..." appears permanently.
I don't mean to be negative–I think the module looks nice, especially the tool tips. On the Aarhus Public Libraries site it's doing a great job of handling multiple branches. But trying to use the module myself gave me the impression that it's still in alpha, not ready for public consumption.

"You're right, no human being would stack books like this."

It needs love, yes

guddo's picture

Yes, the opening_hours module (7.x at least) does need love and is not useable for production, hence the stalling of the "Loading"-thing.

Aarhus and Copenhagen uses 6.x.
I am not sure that the 6.x contains the bugs you are mentioning, but 7.x does.

I'll see if I can get @mikl to update us on the 7.x version somehow/somewhere.

Have you tried the 1.2-beta

mikl's picture

Have you tried the 1.2-beta releases? Or even just checked the issue queue?

I do my best to fix any bugs, but if you can't be bothered to report them, it's kinda hard for me to fix them :)

Ehh, personally I keep myself

guddo's picture

Ehh, personally I keep myself updated with the issues and use the patches I need, yes.
If there is bugs not reported, I would report them (if we didn't, how would you know?).

I'm just kindly asking about the release/development plan of the 7.x module...

I'm just kindly asking about

mikl's picture

I'm just kindly asking about the release/development plan of the 7.x module.

No, you were stating that the module is currently not usable for production, and talking about unfixed bugs at a time where there are no unfixed bugs in the issue queue for the module.

I think that's is rather disrespectful. That might not have been your intention, but having hundreds of hours of hard work dismissed as “unusable” tends to rub developers the wrong way.

There's not much in the way of development plans, besides fixing whatever bugs are reported, since the module itself is mostly feature complete.

I did not mention any unfixed

guddo's picture

I did not mention any unfixed bugs. I hope you know, that I did not mean to be disrespectful.
Therefore let me rephrase; the latest stable release of the module is not ready for production.

What you meant to say was: “I

mikl's picture

What you meant to say was: “I had problems with the 7.x-1.1 release, and I have not tried to see if my problems were fixed in 7.x-1.2-beta2”.

My response to a comment is,

guddo's picture

My response to a comment is, that the module could need some love and that the latest stable release of this module, is not useable for production. That is what I meant and said.

I don't know why you think, that I have had problems with the use of this module or its releases. I haven't.

Your insistence on being the

mikl's picture

Your insistence on being the arbiter on what's “usable in production” is a classic appeal to authority, and thus a fallacious statement.

It would be a lot more honest to specify what problems you've had (since you think it's not ready for production) and also specify what versions you've had problems, so when someone finds this page in the future, they will not be afraid to try out 7.x-1.5 or whatever.

Really? Ok.

guddo's picture

Really? Ok.

I corrected myself. I'm sorry for the inconvenience my contribution to this thread may have had on you - it was not my intention.

Double post.

mikl's picture

Double post.

Please report any problems

mikl's picture

Please report any problems you might find at http://drupal.org/project/issues/opening_hours

Correction of previous comment

guddo's picture

(I excuse my previous reply to you, it was not correct).

I agree that, I think, the opening_hours module could use some love.

I think that Aarhus and Copenhagen uses the 6.x.
Personally I have only had experience with the 7.x module, and I can confirm the bug you are mentioning, since I have stumbled upon it myself.

I do not think that version n7.x-1.1 of the opening_hours is useable for any production site. The reason why I think that version 7.x-1.1 of the module is not ready for production, is the bug mentioned above, which, I think, is described in this issue.

I think the module is actively maintained, and - as, I think, you can see in the issue - patches is being provided rather, I think, fast.

I will get @mikl's attention to this thread, and, I think, maybe he can enlighten us (either in this thread, or in the module itself) when he plan to release the 7.x-1.2 version - that, I think, will contains the patches resolved in the issue queue.

I plan to wait a week or so

mikl's picture

I plan to wait a week or so to see if any problems turn up from the beta2-release. If no bugs appear, I'll just relabel the current beta2 as 1.2 final.

Meanwhile, you can get the beta releases here: http://drupal.org/node/1348432/release

I just wanted to step in,

phette23's picture

I just wanted to step in, since I initiated this side discussion, and say I installed the 7.x-1.2-beta2 release and it's much improved. The "administrative interface loading" bug is gone. You could use it in production. There are still a few rough edges but I'll open issues on the module for them. The only reason I didn't earlier was that the module seemed to be a work-in-progress: no point in filing issues if the maintainer already knows what they need to do. Thanks, mikl, for all your work.

"You're right, no human being would stack books like this."

Libraries

Group organizers

Group categories

Resources

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week