Limit the NumberFormatter to 2 fraction digits in StringUtil::getNumberFormatter()
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 24 Jul 2023 07:23:51 +0000 (09:23 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Mon, 24 Jul 2023 07:23:51 +0000 (09:23 +0200)
see https://www.woltlab.com/community/thread/300795-startseite-beitr%C3%A4ge-pro-tag-ist-%C3%BCbertrieben-genau/

wcfsetup/install/files/lib/util/StringUtil.class.php

index ebc4d6926476bde917345485b0b6ea866cebe086..f5aa729956a6cffbd4e4361a2b42dff67aea7c29 100644 (file)
@@ -824,6 +824,7 @@ final class StringUtil
         $locale = WCF::getLanguage()->getLocale();
         if (!isset($formatters[$locale])) {
             $formatters[$locale] = new \NumberFormatter($locale, \NumberFormatter::DEFAULT_STYLE);
+            $formatters[$locale]->setAttribute(\NumberFormatter::MAX_FRACTION_DIGITS, 2);
         }
 
         return $formatters[$locale];