๐ - `Locale`-utilities for `@maskito/kit`
nsbarsukov opened this issue ยท 0 comments
nsbarsukov commented
Which package(s) are relevant/related to the feature request?
@maskito/kit
Description
Proposed solution
maskitoLocaleNumber(locale: string): MaskitoOptions {}
// inside maskitoLocaleNumber
const thousandSeparator = new Intl.NumberFormat(locale).format(1000).match(/\D/)[0]
const decimalSeparator = new Intl.NumberFormat(locale).format(0.42).match(/\D/)[0];
return maskitoNumberOptions({decimalSeparator, thousandSeparator});
Usage
import {
maskitoLocaleNumber,
maskitoLocaleDate,
maskitoLocaleDateRange,
maskitoLocaleDateTime
} from "@maskito/kit";
const numberOptions = maskitoLocaleNumber(
'de-DE',
{precision: 2} // optionally override any parameter
);
const dateOptions = maskitoLocaleDate('de-DE');
const dateRangeOptions = maskitoLocaleDateRange('de-DE');
const dateTimeOptions = maskitoLocaleDateTime('de-DE');
// [...]
Acceptance criterias
- Every
maskitoLocale*
-utility is tested by Cypress Test - Every
maskitoLocale*
-utility has documentation example (e.g.maskitoLocaleNumber
is put inside Number documentation page)