Where's my weekend?
About
This gem provides some methods to help to deal with weekends! You can see how to use then on Usage session
Installation
Add this line to your application's Gemfile:
gem 'wheres_my_weekend'And then execute:
$ bundleOr install it yourself as:
$ gem install wheres_my_weekendUsage
-
weekend?will returntrueif a date is a weekend day
Time.new(2016, 12, 23).weekend?
# => false
Time.new(2016, 12, 24).weekend?
# => true-
any_weekend?will returntrueif on a array of dates have any weekend day
dates = [Time.new(2016, 12, 23), Time.new(2016, 12, 24), Time.new(2016, 12, 25)]
# => [2016-12-23 00:00:00 -0200, 2016-12-24 00:00:00 -0200, 2016-12-25 00:00:00 -0200]
dates.any_weekend?
# => true-
weekend_dateswill return a array of weekend days from a array of dates
[Time.new(2016, 12, 23), Time.new(2016, 12, 24), Time.new(2016, 12, 25)].weekend_dates
# => [2016-12-24 00:00:00 -0200, 2016-12-25 00:00:00 -0200]-
next_weekendwill return the next weekend from the given date
Time.new(2016, 12, 25).next_weekend
# => [2016-12-31 00:00:00 -0200, 2017-01-01 00:00:00 -0200]-
remove_weekendswill return a array of weekdays from a array of dates
[Time.new(2016, 12, 23), Time.new(2016, 12, 24), Time.new(2016, 12, 25)].weekend_dates
# => [2016-12-23 00:00:00 -0200]Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/odineiribeiro/wheres_my_weekend. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.