diff --git a/components/Blocks/DynamicContent/Overview/Stats/ExpiringPoints/index.tsx b/components/Blocks/DynamicContent/Overview/Stats/ExpiringPoints/index.tsx index fa21a8c83..9f29dfef5 100644 --- a/components/Blocks/DynamicContent/Overview/Stats/ExpiringPoints/index.tsx +++ b/components/Blocks/DynamicContent/Overview/Stats/ExpiringPoints/index.tsx @@ -4,7 +4,6 @@ import { dt } from "@/lib/dt" import Body from "@/components/TempDesignSystem/Text/Body" import { getIntl } from "@/i18n" import { getLang } from "@/i18n/serverContext" -import { formatNumber } from "@/utils/format" import { getMembership } from "@/utils/user" import type { UserProps } from "@/types/components/myPages/user" @@ -27,7 +26,7 @@ export default async function ExpiringPoints({ user }: UserProps) { {intl.formatMessage( { id: "spendable points expiring by" }, { - points: formatNumber(membership.pointsToExpire), + points: intl.formatNumber(membership.pointsToExpire), date: d.format(dateFormat), } )} diff --git a/components/Blocks/DynamicContent/Overview/Stats/Points/PointsColumn/index.tsx b/components/Blocks/DynamicContent/Overview/Stats/Points/PointsColumn/index.tsx index 0d67a14e3..c33fbab8c 100644 --- a/components/Blocks/DynamicContent/Overview/Stats/Points/PointsColumn/index.tsx +++ b/components/Blocks/DynamicContent/Overview/Stats/Points/PointsColumn/index.tsx @@ -44,7 +44,16 @@ async function PointsColumn({ title, subtitle, }: PointsColumnProps) { - const { formatMessage } = await getIntl() + const { formatMessage, formatNumber } = await getIntl() + + function number() { + if (typeof points === "number") { + return formatNumber(points) + } else if (typeof nights === "number") { + return formatNumber(nights) + } + return "N/A" + } return (
@@ -59,7 +68,7 @@ async function PointsColumn({ })} - {points ?? nights ?? "N/A"} + {number()} {subtitle ? ( diff --git a/components/Blocks/DynamicContent/Points/EarnAndBurn/AwardPoints/index.tsx b/components/Blocks/DynamicContent/Points/EarnAndBurn/AwardPoints/index.tsx index e32c3c5ca..73c323f2c 100644 --- a/components/Blocks/DynamicContent/Points/EarnAndBurn/AwardPoints/index.tsx +++ b/components/Blocks/DynamicContent/Points/EarnAndBurn/AwardPoints/index.tsx @@ -1,7 +1,6 @@ import { useIntl } from "react-intl" import Body from "@/components/TempDesignSystem/Text/Body" -import { formatNumber } from "@/utils/format" import { awardPointsVariants } from "./awardPointsVariants" @@ -34,7 +33,7 @@ export default function AwardPoints({ return ( {isCalculated - ? formatNumber(awardPoints) + ? intl.formatNumber(awardPoints) : intl.formatMessage({ id: "Points being calculated" })} ) diff --git a/components/HotelReservation/EnterDetails/Summary/index.tsx b/components/HotelReservation/EnterDetails/Summary/index.tsx index 752f3fd4a..b8d744baa 100644 --- a/components/HotelReservation/EnterDetails/Summary/index.tsx +++ b/components/HotelReservation/EnterDetails/Summary/index.tsx @@ -13,7 +13,6 @@ import Body from "@/components/TempDesignSystem/Text/Body" import Caption from "@/components/TempDesignSystem/Text/Caption" import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" import useLang from "@/hooks/useLang" -import { formatNumber } from "@/utils/format" import styles from "./summary.module.css" @@ -106,7 +105,9 @@ export default function Summary({ {intl.formatMessage( { id: "{amount} {currency}" }, { - amount: formatNumber(parseInt(room.localPrice.price ?? "0")), + amount: intl.formatNumber( + parseInt(room.localPrice.price ?? "0") + ), currency: room.localPrice.currency, } )} @@ -202,7 +203,7 @@ export default function Summary({ {intl.formatMessage( { id: "{amount} {currency}" }, { - amount: formatNumber(totalPrice.local), + amount: intl.formatNumber(totalPrice.local), currency: room.localPrice.currency, } )} @@ -212,7 +213,7 @@ export default function Summary({ {intl.formatMessage( { id: "{amount} {currency}" }, { - amount: formatNumber(totalPrice.euro), + amount: intl.formatNumber(totalPrice.euro), currency: room.euroPrice.currency, } )} diff --git a/components/Section/Header/header.module.css b/components/Section/Header/header.module.css index 48c539418..08a25baf2 100644 --- a/components/Section/Header/header.module.css +++ b/components/Section/Header/header.module.css @@ -1,6 +1,6 @@ .header { display: grid; - gap: var(--Spacing-x1); + gap: var(--Spacing-x1) var(--Spacing-x5); grid-template-columns: 1fr; align-items: baseline; } diff --git a/utils/format.ts b/utils/format.ts deleted file mode 100644 index 7a731f09e..000000000 --- a/utils/format.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Lang } from "@/constants/languages" - -/// Function to format numbers with space as thousands separator -export function formatNumber(num: number) { - // sv hardcoded to force space on thousands - const formatter = new Intl.NumberFormat(Lang.sv) - return formatter.format(num) -}