Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow business hours that cross midnight #227

Open
jmanian opened this issue Mar 7, 2024 · 1 comment
Open

Allow business hours that cross midnight #227

jmanian opened this issue Mar 7, 2024 · 1 comment

Comments

@jmanian
Copy link
Contributor

jmanian commented Mar 7, 2024

It's theoretically possible to have working hours that cross midnight, like for example 11 pm to 7 am. Right now this doesn't seem to be supported.

For example:

time = ActiveSupport::TimeZone.new("America/New_York").now
# Thu, 07 Mar 2024 14:56:02.154340000 EST -05:00

BusinessTime::Config.with(beginning_of_workday: "2:00 pm", end_of_workday: "3:00 pm") { time.during_business_hours? }
# true

BusinessTime::Config.with(beginning_of_workday: "2:00 pm", end_of_workday: "12:01 am") { time.during_business_hours? }
# false

BusinessTime::Config.with(beginning_of_workday: "11:50 pm", end_of_workday: "3:00 pm") { time.during_business_hours? }
# false

It would be nice to support this.

@jmanian
Copy link
Contributor Author

jmanian commented Mar 7, 2024

Looking at the definition of during_business_hours? I see how it could be altered to support this, but I'm not sure whether it should be handled in a more central way or whether there are other methods that need to handle this scenario differently as well, to be consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant