From eeba57fa67b0f6eb7b06bbcccb638917d965ca7a Mon Sep 17 00:00:00 2001 From: Maurice Date: Sat, 4 Jul 2026 22:26:24 +0200 Subject: [PATCH] fix(costs): KGS is selectable as default/expense currency (#1400) --- .../components/Budget/BudgetPanel.constants.ts | 8 ++++---- client/src/utils/formatters.test.ts | 16 +++++++++++++++- client/src/utils/formatters.ts | 6 +++--- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/client/src/components/Budget/BudgetPanel.constants.ts b/client/src/components/Budget/BudgetPanel.constants.ts index d5f2bd8a5..d6bd5d7af 100644 --- a/client/src/components/Budget/BudgetPanel.constants.ts +++ b/client/src/components/Budget/BudgetPanel.constants.ts @@ -2,8 +2,8 @@ export const CURRENCIES = [ 'EUR', 'USD', 'GBP', 'JPY', 'CHF', 'CZK', 'PLN', 'SEK', 'NOK', 'DKK', 'TRY', 'THB', 'AUD', 'CAD', 'NZD', 'BRL', 'MXN', 'INR', 'IDR', 'MYR', 'PHP', 'SGD', 'KRW', 'CNY', 'HKD', 'TWD', 'ZAR', 'AED', 'SAR', 'ILS', - 'EGP', 'MAD', 'HUF', 'RON', 'BGN', 'HRK', 'ISK', 'RUB', 'UAH', 'BDT', - 'LKR', 'VND', 'CLP', 'COP', 'PEN', 'ARS', + 'EGP', 'MAD', 'HUF', 'RON', 'BGN', 'HRK', 'ISK', 'RUB', 'UAH', 'KGS', + 'BDT', 'LKR', 'VND', 'CLP', 'COP', 'PEN', 'ARS', ] export const SYMBOLS: Record = { @@ -13,8 +13,8 @@ export const SYMBOLS: Record = { PHP: '₱', SGD: 'S$', KRW: '₩', CNY: '¥', HKD: 'HK$', TWD: 'NT$', ZAR: 'R', AED: 'د.إ', SAR: '﷼', ILS: '₪', EGP: 'E£', MAD: 'MAD', HUF: 'Ft', RON: 'lei', BGN: 'лв', HRK: 'kn', ISK: 'kr', RUB: '₽', - UAH: '₴', BDT: '৳', LKR: 'Rs', VND: '₫', CLP: 'CL$', COP: 'CO$', - PEN: 'S/.', ARS: 'AR$', + UAH: '₴', KGS: 'сом', BDT: '৳', LKR: 'Rs', VND: '₫', CLP: 'CL$', + COP: 'CO$', PEN: 'S/.', ARS: 'AR$', } export const PIE_COLORS = ['#6366f1', '#ec4899', '#f59e0b', '#10b981', '#3b82f6', '#8b5cf6', '#ef4444', '#14b8a6', '#f97316', '#06b6d4', '#84cc16', '#a855f7'] diff --git a/client/src/utils/formatters.test.ts b/client/src/utils/formatters.test.ts index 1e70e0cd3..00a2aaf11 100644 --- a/client/src/utils/formatters.test.ts +++ b/client/src/utils/formatters.test.ts @@ -1,5 +1,6 @@ import { describe, it, expect } from 'vitest' -import { splitReservationDateTime, resolveDayId } from './formatters' +import { splitReservationDateTime, resolveDayId, formatMoney } from './formatters' +import { CURRENCIES, SYMBOLS } from '../components/Budget/BudgetPanel.constants' import type { Day } from '../types' const days = [ @@ -25,6 +26,19 @@ describe('resolveDayId', () => { }) }) +describe('KGS currency (#1400)', () => { + it('is selectable everywhere the shared currency list feeds', () => { + expect(CURRENCIES).toContain('KGS') + expect(SYMBOLS.KGS).toBeTruthy() + }) + it('formats without throwing', () => { + // Lenient: older ICU builds may lack ru-KG/KGS display data and fall back. + const out = formatMoney(1234.56, 'KGS', 'en') + expect(out).toMatch(/сом|KGS/) + expect(out).toContain('234') + }) +}) + describe('splitReservationDateTime', () => { it('parses full ISO datetime', () => { expect(splitReservationDateTime('2026-06-25T10:00')).toEqual({ date: '2026-06-25', time: '10:00' }) diff --git a/client/src/utils/formatters.ts b/client/src/utils/formatters.ts index afa8cf259..c7522f7f2 100644 --- a/client/src/utils/formatters.ts +++ b/client/src/utils/formatters.ts @@ -52,9 +52,9 @@ const CURRENCY_LOCALE: Record = { PHP: 'en-PH', SGD: 'en-SG', KRW: 'ko-KR', CNY: 'zh-CN', HKD: 'en-HK', TWD: 'zh-TW', ZAR: 'en-ZA', AED: 'en-AE', SAR: 'en-SA', ILS: 'he-IL', EGP: 'en-EG', MAD: 'fr-MA', HUF: 'hu-HU', RON: 'ro-RO', BGN: 'bg-BG', - HRK: 'hr-HR', ISK: 'is-IS', RUB: 'ru-RU', UAH: 'uk-UA', BDT: 'en-BD', - LKR: 'en-LK', VND: 'vi-VN', CLP: 'es-CL', COP: 'es-CO', PEN: 'es-PE', - ARS: 'es-AR', + HRK: 'hr-HR', ISK: 'is-IS', RUB: 'ru-RU', UAH: 'uk-UA', KGS: 'ru-KG', + BDT: 'en-BD', LKR: 'en-LK', VND: 'vi-VN', CLP: 'es-CL', COP: 'es-CO', + PEN: 'es-PE', ARS: 'es-AR', } export function currencyLocale(currency: string): string {