@dvcol/common-utils
Version:
Typescript library for common utility functions and constants
17 lines (15 loc) • 529 B
JavaScript
// lib/common/utils/intl.utils.ts
var getIntl = () => Intl.DateTimeFormat().resolvedOptions();
var getIntlLocale = () => getIntl().locale;
var getIntlLanguage = () => getIntlLocale().split("-").shift();
var getIntlRegion = () => getIntlLocale().split("-").pop();
var getNavigatorLanguage = () => navigator?.language?.split("-").shift();
var getNavigatorRegion = () => navigator?.language?.split("-").pop();
export {
getIntl,
getIntlLocale,
getIntlLanguage,
getIntlRegion,
getNavigatorLanguage,
getNavigatorRegion
};