diff --git a/frontend/src/components/Bank.tsx b/frontend/src/components/Bank.tsx index 78e442b9..85f486e7 100644 --- a/frontend/src/components/Bank.tsx +++ b/frontend/src/components/Bank.tsx @@ -9,7 +9,7 @@ import * as React from "react" import { ListGroup, ListGroupItem, Table } from "reactstrap" import BankService from "../api/services/BankService" -import { BANKING_URL, CURRENCY } from "../global/constants" +import { BANKING_URL } from "../global/constants" import { isToday, prettyDateWithDayYearIfDiff, prettyTimeWithSeconds } from "../global/funcDateTime" import { prettyAmount } from "../global/utils" import { BankType } from "../types/models" @@ -121,7 +121,7 @@ export default class Bank extends React.PureComponent<{}, State> { Aktuální stav:{" "} {balance ? ( - {`${prettyAmount(balance)} ${CURRENCY}`} + {prettyAmount(balance)} ) : this.state.isDataProblem ? ( "neznámý" @@ -133,7 +133,7 @@ export default class Bank extends React.PureComponent<{}, State> { Na účtu není dostatek peněz (alespoň{" "} - {`${prettyAmount(rentPrice)} ${CURRENCY}`} + {prettyAmount(rentPrice)} ) pro zaplacení nájmu! @@ -247,7 +247,7 @@ export default class Bank extends React.PureComponent<{}, State> { - {prettyAmount(amount)} {CURRENCY} + {prettyAmount(amount)} ) diff --git a/frontend/src/global/constants.ts b/frontend/src/global/constants.ts index 64961a1b..3f029279 100644 --- a/frontend/src/global/constants.ts +++ b/frontend/src/global/constants.ts @@ -61,9 +61,6 @@ export enum USER_CELEBRATION { NAMEDAY = 2, } -/** Výchozí měna. */ -export const CURRENCY = "Kč" - /** URL adresa GitHub repozitáře s aplikací. */ export const GITHUB_REPO_URL = "https://github.com/rodlukas/UP-admin" diff --git a/frontend/src/global/utils.ts b/frontend/src/global/utils.ts index 9e5704f6..8e9c827b 100644 --- a/frontend/src/global/utils.ts +++ b/frontend/src/global/utils.ts @@ -117,7 +117,11 @@ export function getDefaultValuesForLecture( /** Vrátí částku ve srozumitelném formátu. */ export function prettyAmount(amount: number): string { - return amount.toLocaleString(LOCALE_CZ) + return amount.toLocaleString(LOCALE_CZ, { + style: "currency", + currency: "CZK", + maximumFractionDigits: 0, + }) } /** Workaround dokud nebude fungovat required v react-selectu - TODO. */