Git Product home page Git Product logo

Comments (6)

craiglittle avatar craiglittle commented on June 13, 2024

Yep, that's supported!

Here's an example schedule with business hours during every day of the week, including weekend days:

Biz::Schedule.new do |config|
  config.business_hours = {
    mon: {'09:00' => '17:00'},
    tue: {'09:00' => '17:00'},
    wed: {'09:00' => '17:00'},
    thu: {'09:00' => '17:00'},
    fri: {'09:00' => '17:00'},
    sat: {'10:00' => '14:00'},
    sun: {'10:00' => '14:00'}
  }
end

Does that make sense?

from biz.

fredwu avatar fredwu commented on June 13, 2024

Thanks for the prompt response! :)

Yep, that's what I thought how it could be done, although for my specific use case, I only like to specify specific dates as working days, e.g. Chinese New Year holiday essentially swaps two weekend days as working days. The code you provided would then require specifying all "normal" weekend days as holidays.

from biz.

craiglittle avatar craiglittle commented on June 13, 2024

Ah, that's interesting. It sounds like you're looking for something like "reverse holidays" where the time is on instead of off. I don't know if that's a use case we'd support in the gem proper, but it's an interesting concept for a potential extension.

In any case, it could be approximated by configuring business hours for the weekend as necessary for the Chinese New Year and then configuring all other "normal" weekend dates as holidays.

It wouldn't be the most elegant solution in the world, but it would be accurate!

from biz.

fredwu avatar fredwu commented on June 13, 2024

It sounds like you're looking for something like "reverse holidays" where the time is on instead of off.

Yep, exactly!

I don't know if that's a use case we'd support in the gem proper, but it's an interesting concept for a potential extension.

No worries, when I have time I might look into it. :)

Thanks for such quick responses, I appreciate it!

from biz.

ziweizhou avatar ziweizhou commented on June 13, 2024

Is it possible to implement this feature? I need it as well for my app.

Thanks a lot.

from biz.

craiglittle avatar craiglittle commented on June 13, 2024

@fredwu @ziweizhou

I wanted to let you know that I just merged a PR to implement this feature: #109

Check it out, and let me know what you think!

from biz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.