How Can i display the remai开发者_StackOverflow中文版ning weeks of the year in rails?
You don't really specify a format here obviously, but something like this will show you the index of every week left in the year:
(Date.today.cweek..52).each { |w| puts w }
See Looping through weeks of the year in Ruby (Sinatra) for a similar question
(Date.today.cweek...Date.today.end_of_year.cweek)
EDIT
(Date.today.cweek...Date.today.end_of_year.cweek).each_slice(2) do |weeks|
puts weeks.join("-")
end
精彩评论