How to calculate next, previous business day in Rails?

前端 未结 12 2331
粉色の甜心
粉色の甜心 2021-02-08 08:43

How to calculate next and previous business days in Rails?

12条回答
  •  独厮守ぢ
    2021-02-08 09:36

    this is implementation:

    require 'business_time'
    
    date = Time.now
    
    next_workday(date)
    
    private
    
    def next_workday(date:)
      return date = date.next_weekday while date.workday?
    end
    

提交回复
热议问题