Created
April 18, 2014 07:48
-
-
Save StephenOTT/11030133 to your computer and use it in GitHub Desktop.
Find Missing Dates between a Date Range
This file contains hidden or 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
a = [] | |
output.each do |x| | |
a << x["converted_date"] | |
end | |
b = (output.first["converted_date"]..output.last["converted_date"]).to_a | |
zeroValueDates = (b.map{ |date| date.strftime("%b %Y") } - a.map{ |date| date.strftime("%b %Y") }).uniq | |
zeroValueDates.each do |zvd| | |
zvd = DateTime.parse(zvd) | |
output << {"repo"=> repo , "state"=>"closed", "closed_year"=>zvd.strftime("%Y").to_i, "closed_month"=>zvd.strftime("%m").to_i, "count"=>0, "converted_date"=>zvd} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment