完成版本库时间UTC与北京时间的转换

时间国际化问题
This commit is contained in:
huang 2016-04-21 10:09:52 +08:00
parent 449bdf2225
commit e8048f8eb7
2 changed files with 11 additions and 1 deletions

View File

@ -52,6 +52,12 @@ module RepositoriesHelper
end
end
def translate_time time
case time
when time.include("")
end
end
# 获取diff内容行号
def diff_line_num content
content.scan(/@@ -(\d+),\d+ \+\d+,\d+ @@/).first.join("").to_i

View File

@ -43,7 +43,11 @@
</div>
</td>
<td class="tree-age c_grey">
<div class="hidden" title="<%= distance_of_time_in_words(latest_changes.time, Time.now) if latest_changes && latest_changes.time %>"><%= distance_of_time_in_words(latest_changes.time, Time.now) if latest_changes && latest_changes.time %></div>
<div class="hidden" title="<%= distance_of_time_in_words(latest_changes.time, Time.now + 8.hours) if latest_changes && latest_changes.time %>">
<%# 为了转换UTC时间时差8小时 %>
<%= distance_of_time_in_words(latest_changes.time, Time.now + 8.hours) if latest_changes && latest_changes.time %>
<%#= latest_changes.time if latest_changes && latest_changes.time %>
</div>
</td>
</div>
<%# end %>