Skip to content

Allow business hours that cross midnight #227

@jmanian

Description

@jmanian

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions