X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/5ce14cfa4d7792346e96a3895df73e3510c936ea..e4c40cbd36567d050f1b779f1444c4ef26c50a5b:/app/helpers/user_blocks_helper.rb 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))