No commit activity in last 3 years
No release in over 3 years
Gem that indentifies weekends!
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
~> 10.0
~> 3.0
 Project Readme

Where's my weekend?

Build Status

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:

$ bundle

Or install it yourself as:

$ gem install wheres_my_weekend

Usage

  • weekend? will return true if a date is a weekend day
Time.new(2016, 12, 23).weekend?
# => false

Time.new(2016, 12, 24).weekend?
# => true
  • any_weekend? will return true if 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_dates will 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_weekend will 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_weekends will 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.