moment.js实现客户端显示本地时间

$(document).ready(function(){
  $('.local_time').text(moment.utc($('.local_time').text()).local().format('YYYY-MM-DD HH:mm:ss'));
});
 
$(document).ajaxComplete(function(){
  $('.local_time').text(moment.utc($('.local_time').text()).local().format('YYYY-MM-DD HH:mm:ss'));
});
 
<span class='local_time'><%= order_item.shippings.first.try(:updated_at) %></span>

猜你喜欢

转载自schooltop.iteye.com/blog/2313618
今日推荐