Date.newの引数に負の数が使えることを知らなかったのでメモ
require "date"
Time.now.to_a[4..5].tap { |month, year|
puts [ *Date.new(year, month)..Date.new(year, month, -1) ]
}
Go to list of users who liked
More than 5 years have passed since last update.
Date.newの引数に負の数が使えることを知らなかったのでメモ
require "date"
Time.now.to_a[4..5].tap { |month, year|
puts [ *Date.new(year, month)..Date.new(year, month, -1) ]
}
Register as a new user and use Qiita more conveniently
Go to list of users who liked