X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/5ce14cfa4d7792346e96a3895df73e3510c936ea..3bc20b6f21cb52a1ccaf10728a7e383df9fe7a7e:/app/helpers/user_blocks_helper.rb?ds=sidebyside diff --git a/app/helpers/user_blocks_helper.rb b/app/helpers/user_blocks_helper.rb index 0528140f4..95b6cb600 100644 --- a/app/helpers/user_blocks_helper.rb +++ b/app/helpers/user_blocks_helper.rb @@ -26,6 +26,8 @@ module UserBlocksHelper end def block_duration_in_words(duration) + # Ensure the requested duration isn't negative, even by a millisecond + duration = 0 if duration.negative? parts = ActiveSupport::Duration.build(duration).parts if duration < 1.day t("user_blocks.helper.block_duration.hours", :count => parts.fetch(:hours, 0))