我想知道是否有可能從回應中獲得幾個月的軌道。如果我的資料包含published.at: '2020-12-31 08:00:00 UTC'. 如何在我的 html 中呈現Published: 3 months ago而不是顯示整個日期?現在我將其顯示為<%= item.published_at %>
uj5u.com熱心網友回復:
您可以使用time_ago_in_words
Published <%= time_ago_in_words(item.published_at) %> ago
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/427185.html
上一篇:決議包含json字串的json
