website: make locale-sensitive number formatting work in web browsers without requestIdleCallback

This commit is contained in:
Rasmus Andersson 2023-11-20 08:22:35 -08:00
parent 346a08d307
commit 8cadd9abd5

View file

@ -1386,7 +1386,7 @@ let observer = new IntersectionObserver(callback, { rootMargin: "0px", threshold
observer.observe($('h1'))
// low priority stuff that doesn't need to happen immediately
requestIdleCallback(() => {
;(typeof requestIdleCallback == "undefined" ? f => f() : requestIdleCallback)(() => {
// convert .num/num numbers to local format, e.g. "1,234.56" vs "1.234,56"
let nfmt = new Intl.NumberFormat() // test with .NumberFormat('de-DE')
if (nfmt.format(1234.89) != "1,234.89") { // written as "1,234.89" in source