Ensure that short duration blockss are shown as '0 hours'
Passing `:count => nil` means that i18n.t will return the hash of translations, so use a default value of 0 when checking for hours to prevent this. Refs #3210
This commit is contained in:
parent
baa32464cd
commit
5ce14cfa4d
2 changed files with 16 additions and 1 deletions
|
@ -28,7 +28,7 @@ module UserBlocksHelper
|
|||
def block_duration_in_words(duration)
|
||||
parts = ActiveSupport::Duration.build(duration).parts
|
||||
if duration < 1.day
|
||||
t("user_blocks.helper.block_duration.hours", :count => parts[:hours])
|
||||
t("user_blocks.helper.block_duration.hours", :count => parts.fetch(:hours, 0))
|
||||
elsif duration < 1.week
|
||||
t("user_blocks.helper.block_duration.days", :count => parts[:days])
|
||||
elsif duration < 1.month
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue