From: Josh Cheek Date: 2010-06-12T03:57:20+09:00 Subject: Re: Business hours processing --0016e6d64b1834f5be0488c5b5b3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 2010/6/11 S=C5=82awosz S=C5=82awi=C5=84ski > Hi, > I need to determine how many business hours left to some Time. Do you > know any library with this feature? > > S=C5=82awosz > -- > Posted via http://www.ruby-forum.com/. > > From http://www.rubyinside.com/3-new-date-and-time-libraries-for-rubyists-3238.h= tml business_time - Time and date offsets based on "business time/hours" business_time is a new library that works with the concept of "business time" or "business hours." Rather than just letting you perform operations on dates by absolute numbers of days or hours, you can now work with business days and hours of your own definition. business_time depends heavily on Active Support. To install: gem install business_time Note: business_time depends on Active Support (gem: activesupport) To use: require 'active_support' require 'business_time' # Examples "from now" 4.business_hours.from_now 5.business_days.from_now # Using user supplied dates my_birthday =3D Date.parse("August 4th, 2010") 10.business_days.before(my_birthday) # Add a day to not count as a business day BusinessTime::Config.holidays << my_birthday # Overlapping days are OK 6.business_hours.after(Time.parse("August 3rd, 3:00pm")) --0016e6d64b1834f5be0488c5b5b3--