jquery-countdown-railsを導入したのですが、時間が24時間づれます。(先に進む?)
例:タイムリミットを明日の今頃に設定すると、今日の今頃に設定したことになります。
正しく表示するにはどうしたら良いでしょうか
lang
1 2 <ul class="list-group list-group-flush text-center"> 3 <li class="list-group-item">残り 4 <div class="countdown" data-until="<%= @item.limit_day.to_json %>" ></div> 5 </li> 6 </ul> 7 8
lang
1$(document).ready(function(){ 2 $('.countdown').each(function(){ 3 $(this).countdown({until: new Date($(this).data('until')), format: $(this).data('format')}); 4 }); 5}); 6 7(function($) { 8 $.countdown.regionalOptions['ja'] = { 9 labels: ['年', '月', '週', '日', '時', '分', '秒'], 10 labels1: ['年', '月', '週', '日', '時', '分', '秒'], 11 compactLabels: ['年', '月', '週', '日'], 12 whichLabels: null, 13 digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], 14 timeSeparator: ':', isRTL: false}; 15 $.countdown.setDefaults($.countdown.regionalOptions['ja']); 16})(jQuery);
lang
1 class Application < Rails::Application 2 config.assets.paths << "#{Rails}/vendor/assets/fonts" 3 # 表示時のタイムゾーンをJSTに変更 4 config.time_zone = 'Tokyo' 5 # DB保存時のタイムゾーンをJSTに変更 6 config.active_record.default_timezone = :local 7 # ロケールを日本語に変更 8 config.i18n.default_locale = :ja
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/01/30 14:55
2015/01/30 14:57
2015/01/30 15:12
2015/01/30 15:13
2015/01/30 15:24