0
주 숫자보다 먼저 계산 된 주 수를 표시하려고합니다. "x 주 전" 1 주일 전, 2 주 전, 3 주 전, 1 개월 전, 2 개월 전, 1 년 전 등등주 단위로 주 수를 표시 하시겠습니까?
임 사용 방법 도우미 :
보기에서def weeks_ago_in_words(from_time, include_seconds = false)
to_time = Time.now
weeks_ago = ((to_time - from_time)/1.week).abs
[nil, "last week", "two weeks ago", "three weeks ago"][weeks_ago] ||
distance_of_time_in_words(from_time, to_time, include_seconds)
end
:
= weeks_ago_in_words(Time.local(2013) + week.to_i)
week = a week number like 1,10,28,52 etc
이 나에게 올바른 resuls를 제공하지 않습니다,있는 "X 주 전에 계산하는 더 나은 방법이 "weeknumer에 따라?
시도했지만 작동하지 않습니다. 주 번호 만 기반으로 한 주간을 얻고 싶습니다. – Rubytastic