Created
December 25, 2015 03:51
-
-
Save watzon/425f8072e4d57c19a08f to your computer and use it in GitHub Desktop.
Take ruby date range and see if any values from an array match values in the range
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'date' | |
range = (Date.today-7)..(Date.today) | |
dates = ['2015-12-02','2015-12-03','2015-12-14','2015-12-19','2015-12-21','2015-12-23'] | |
dates.each do |date| | |
date = Date.parse(date) | |
if range.include?(date) | |
puts date | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment