Skip to content

Instantly share code, notes, and snippets.

@StephenOTT
Created April 18, 2014 07:48
Show Gist options
  • Save StephenOTT/11030133 to your computer and use it in GitHub Desktop.
Save StephenOTT/11030133 to your computer and use it in GitHub Desktop.
Find Missing Dates between a Date Range
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