Создание заказов
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Форматирует цену с разделением разрядов пробелом (русский стандарт).
|
||||
* Пример: 400000 → "400 000 ₽"
|
||||
*/
|
||||
export function formatPrice(amount: number, type?: number | string): string {
|
||||
if (type === 2 || type === "Negotiable") return "Договорная"
|
||||
|
||||
const formatted = amount.toLocaleString("ru-RU", {
|
||||
maximumFractionDigits: 0,
|
||||
useGrouping: true,
|
||||
})
|
||||
|
||||
const suffix = (type === 1 || type === "Hourly") ? "/час" : ""
|
||||
return `${formatted} ₽${suffix}`
|
||||
}
|
||||
|
||||
/**
|
||||
* Форматирует число с разделением разрядов пробелом.
|
||||
* Пример: 400000 → "400 000"
|
||||
*/
|
||||
export function formatNumber(amount: number): string {
|
||||
return amount.toLocaleString("ru-RU", {
|
||||
maximumFractionDigits: 0,
|
||||
useGrouping: true,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user