app/helpers/timepiece_helper.rb in timepiece-0.2.10 vs app/helpers/timepiece_helper.rb in timepiece-0.2.11

- old
+ new

@@ -79,15 +79,15 @@ seconds = seconds_diff time = "<span class='timepiece-days'>#{days.to_s}</span>"\ "<span class='timepiece-separator tp-separator-days-hours'>:</span>"\ - "<span class='timepiece-hours'>#{hours.to_s}</span>"\ + "<span class='timepiece-hours'>#{"%02d" % hours}</span>"\ "<span class='timepiece-separator tp-separator-hours-minutes'>:</span>"\ - "<span class='timepiece-minutes'>#{minutes.to_s}</span>"\ + "<span class='timepiece-minutes'>#{"%02d" % minutes}</span>"\ "<span class='timepiece-separator tp-separator-minutes-seconds'>:</span>"\ - "<span class='timepiece-seconds'>#{seconds.to_s}</span>" + "<span class='timepiece-seconds'>#{"%02d" % seconds}</span>" # "<span class='timepiece-seconds'>#{seconds.to_s.rjust(2, '0')}</span>" # Note: rjust; it might be useful. content_tag(:span, time.html_safe, class: 'timepiece-timer', 'data-days' => days, 'data-hours' => hours, 'data-minutes' => minutes, 'data-seconds' => seconds, 'id' => (id unless id.blank?)) end def timer_in_words(time_since = Time.now, id: '') @@ -131,14 +131,14 @@ seconds = seconds_diff time = "<span class='timepiece-days'>#{days.to_s}</span>"\ "<span class='timepiece-separator tp-separator-days-hours'>:</span>"\ - "<span class='timepiece-hours'>#{hours.to_s}</span>"\ + "<span class='timepiece-hours'>#{"%02d" % hours}</span>"\ "<span class='timepiece-separator tp-separator-hours-minutes'>:</span>"\ - "<span class='timepiece-minutes'>#{minutes.to_s}</span>"\ + "<span class='timepiece-minutes'>#{"%02d" % minutes}</span>"\ "<span class='timepiece-separator tp-separator-minutes-seconds'>:</span>"\ - "<span class='timepiece-seconds'>#{seconds.to_s}</span>" + "<span class='timepiece-seconds'>#{"%02d" % seconds}</span>" # "<span class='timepiece-seconds'>#{seconds.to_s.rjust(2, '0')}</span>" # Note: rjust; it might be useful. content_tag(:span, time.html_safe, class: 'timepiece-countdown', 'data-days' => days, 'data-hours' => hours, 'data-minutes' => minutes, 'data-seconds' => seconds, 'id' => (id unless id.blank?)) end def countdown_in_words(time_until = Time.new(2016), id: '') \ No newline at end of file