Strictly follows Semantic Versioning 2.0.0.
2025-02-26
🐛 Bug fixes:
formatCountry()
circular dependency fix;vite
build log example:
Export "formatCountry" of module "node_modules/@dnvgl/i18n/lib/formatCountry.js" was reexported through module "node_modules/@dnvgl/i18n/lib/index.js" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
2025-02-05
🚀 Features:
CUC
currency treated as historical:findIso4217Currency()
,getIso4217Currencies()
. This currency was withdrawn in2021
, but because ISO update was released on2025-02-04
we will use the second date. We don't want to introduce any breaking change when usingstatusForTheDay
feature.
{
alpha3Code: "CUC",
currencyName: "Peso Convertible",
numericCode: 931,
minorUnit: 2,
historicalFrom: "2025-02-04" // CHANGED (before: undefined)
}
🔧 Internal:
- TypeScript upgrade
5.5.2
->5.7.3
2024-09-17
🐛 Bug fixes:
ZWG
currency should be returned from2024-09-01
for Zimbabwe (ZWL
currency was returned instead)findIso4217CurrencyForIso3166Country()
🔧 Internal:
- TypeScript upgrade
5.5.2
->5.6.2
2024-06-26
🚀 Features:
- support for
ZWG
currency:findIso4217Currency()
andfindIso4217CurrencyForIso3166Country()
{
alpha3Code: "ZWG", // NEW
currencyName: "Zimbabwe Gold", // NEW
numericCode: 924, // NEW
minorUnit: 2, // NEW
introducedIn: "2024-06-25" // NEW
},
{
alpha3Code: "ZWL",
currencyName: "Zimbabwe Dollar",
numericCode: 932,
minorUnit: 2,
historicalFrom: "2024-09-01" // CHANGED (before: undefined)
}
🔧 Internal:
- TypeScript upgrade
5.4.5
->5.5.2
2024-05-10
🚀 Features:
- TypeScript
5.4.x
support
// before
export type Locale = Intl.BCP47LanguageTag | Intl.BCP47LanguageTag[]; // TS 5.3.x
// new:
export type Locale = Intl.LocalesArgument; // TS 5.4.x
🔧 Internal:
- TypeScript upgrade
5.3.2
->5.4.5
2023-12-11
🚀 Features:
- support for
XCG
currency (future replacement forANG
):findIso4217Currency()
andfindIso4217CurrencyForIso3166Country()
{
alpha3Code: "ANG",
currencyName: "Netherlands Antillean Guilder",
numericCode: 532,
minorUnit: 2,
historicalFrom: "2025-03-31" // CHANGED (before: undefined)
},
// ... other currencies
{
alpha3Code: "XCG", // NEW
currencyName: "Caribbean Guilder", // NEW
numericCode: 532, // NEW
minorUnit: 2, // NEW
introducedIn: "2025-03-31" // NEW
},
findIso4217CurrencyForIso3166Country()
: new argumentstatusForTheDay
has been introduced
2023-02-21
🚀 Features:
getDayJsFormat()
- convertsIntl
current locale format today.js
format; in practice the implementation is the same as ingetMomentFormat()
sogetDayJsFormat()
is an alias forgetMomentFormat()
findIso4217CurrencyForIso3166Country()
- returnsISO4217
currency for specificISO3166
country
findIso4217CurrencyForIso3166Country(code: Iso3166Alpha2Code | Iso3166Alpha3Code | Iso3166NumericCode): Iso4217Currency | undefined
📄 Documentation:
getMomentFormat()
- AntD v5 example updategetDateFnsFormat()
- AntD v5 example update
2022-12-22
🚀 Features:
getIso3166Countries()
-"Turkey"
country name has been changed to"Türkiye"
{
countryName: "Türkiye",
officialStateName: "The Republic of Türkiye",
alpha2Code: "TR",
alpha3Code: "TUR",
numericCode: 792
}
getIso4217Currencies()
- from2023-01-01
Kuna currency (HRK) will be treated as historical because Croatia joins the euro. New argumentstatusForTheDay
has been introduced. WhenstatusForTheDay
is defined then only valid (non-historical) currencies are returned.statusForTheDay = undefined
means today (new Date()
).Iso4217Currency
has two new optional properties:historicalFrom?: DateIsoString
,introducedIn?: DateIsoString
(for future use).
getIso4217Currencies(statusForTheDay?: Date | DateIsoString): Iso4217Currency[]
interface Iso4217Currency {
// ... old properties
historicalFrom?: DateIsoString; // e.g. "2023-01-01"
introducedIn?: DateIsoString;
}
🔧 Internal:
- TypeScript upgrade
4.7.2
->4.9.4
2022-10-24
🚀 Features:
formatNumber()
- new overload, acceptsNumberFormatIntl
options, that can be created usingcreateNumberFormat()
. This new overload is dedicated when formatting is used many times (thousands, e.g. big tables with financial data). The source of the problems is creatingnew Intl.NumberFormat
, which is expensive. UsingcreateNumberFormat()
it can be created only once and re-used.
const options = createNumberFormat({ thousandsSeparator: false }, "de");
formatNumber(12486.4, options);
formatNumber(100, options);
🔧 Internal:
- renamed
createDateFormat()
->createDateFormatIntlObj()
- renamed
createNumberFormat()
->createNumberFormatIntlObj()
📄 Documentation:
formatNumber()
- performance resultscompareStringsFactory()
- performance results
2022-10-06
🚀 Features:
formatNumber()
,formatNumberToFixed()
,formatMoney()
- acceptscurrency
as numeric representation (e.g.USD = 840
).
formatMoney(1.532, { precision: 2, currency: 840 }, "pl-PL")
formatNumber()
,formatNumberToFixed()
,formatMoney()
- accepts new optioncurrencySign
(Safari >=14.1
). Defaults:currencySign: "standard"
whencurrency
value is provided.
formatMoney(-1.532, { precision: 2, currency: 840, currencySign: "accounting" })
getCurrencySymbol()
- accepts new optioncurrencyDisplay
(Safari >=14.1
)
getCurrencySymbol({ currency: "CAD", currencyDisplay: "narrowSymbol" }, "en")
2022-10-05
🚀 Features:
formatNumber()
,formatNumberToFixed()
,formatMoney()
- accepts new optionscurrency
andcurrencyDisplay
(Safari >=14.1
). Defaults:currencyDisplay: "symbol"
whencurrency
value is provided.
{ currency: "USD", currencyDisplay: "code" }
2022-10-04
🚀 Features:
getCurrencySymbol(): string
💡 Enhancements:
parseNumber()
- optimization (redundant NaN check)
🔧 Internal:
- TypeScript upgrade
4.7.2
->4.8.4
2022-05-27
🚀 Features:
getIso4217Currencies(): Iso4217Currency[]
findIso4217Currency(code: Iso4217Alpha3Code | Iso4217NumericCode): Iso4217Currency | undefined
isValidIso4217Code(code: Iso4217Alpha3Code | Iso4217NumericCode): boolean
formatCurrency(currency: Iso4217Alpha3Code | Iso4217NumericCode, locale?: Locale): string
💡 Enhancements:
formatCountry()
- ensured that invalid country code is handled without throwing an error (this case was previously undocumented); for invalid string code the same string is returned, but for invalid numeric code empty string is returned
2022-05-25
🚀 Features:
getCountryCodeFromBic(bic: string): Iso3166Alpha2Code | "XK" | undefined
getCountryCodeFromIban(iban: string): Iso3166Alpha2Code | "XK" | undefined
🔧 Internal:
- TypeScript upgrade
4.6.4
->4.7.2
2022-05-22
🚀 Features:
roundUsingHalfAwayFromZero(value: number, precision: number): number
formatNumber()
,formatNumberToFixed()
-negativeZero
(boolean
) option
formatNumber(-0.001, { maxPrecision: 2, negativeZero: false }, "en-US"); // returns "0" instead of "-0"
roundUsingBankersMethod()
- allow to useInfinity
precision (returns the same number passed as the argument)
💡 Enhancements:
roundUsingBankersMethod()
- improvedprecision
argument validation (RangeError
is thrown forprecision < 0
or equal toNaN
)roundUsingBankersMethod()
-precision
value is converted usingMath.trunc
to ensure that the value is an integer (without throwing an error)
2022-04-25
🚀 Features:
formatMonth(month: number, monthFormat: MonthFormat, locale?: Locale): string
formatMonth(date: Date | DateIsoString, monthFormat: MonthFormat, locale?: Locale): string
2022-03-03
🚀 Features:
formatNumberToFixed()
has simpler overload that accepts precision as number argument:
formatNumberToFixed(value: number, precision?: number, locale?: Locale): string
🔧 Internal:
- TypeScript upgrade
4.5.2
->4.6.2
2021-11-22
🚀 Features:
formatCountry(country: Iso3166Alpha2Code | Iso3166Alpha3Code | Iso3166NumericCode, locale?: Locale): string
🔧 Internal:
- deprecated function
substr()
has been replaced bysubstring()
2021-11-19
🚀 Features:
getStatesOfUsa(): StateOfUsa[]
2021-04-27
Exactly the same as v0.4.0
but major version was set to 1
. The reason is to follow Semantic Versioning 2.0.0. for public, stable API.
2021-04-27
🚀 Features:
2021-04-26
🚀 Features:
2021-04-20
🚀 Features:
💡 Enhancements:
sortBy()
,sortByInplace()
- allow sorting by with same order for all selectors
2021-04-13
Initial public release.
🚀 Features:
- capitalizeFirstLetter()
- compareBooleans()
- compareDates()
- compareNumbers()
- compareNumbersAlike()
- compareStrings()
- compareStringsFactory()
- formatDate()
- formatDateToISO()
- formatIban()
- formatInteger()
- formatMoney()
- formatNumber()
- formatNumberToFixed()
- formatRelativeTime()
- formatString()
- formatTime()
- getDateFnsFormat()
- getDecimalSeparator()
- getMinusSign()
- getMomentFormat()
- getSystemLocaleName()
- getThousandsSeparator()
- lowercaseFirstLetter()
- normalizeForSearching()
- parseNumber()
- plural()
- roundUsingBankersMethod()
- sort()
- sortBy()
- sortByInplace()
- sortInplace()
- transformToInputNumericString()