@leafygreen-ui/date-utils
Version:
LeafyGreen UI Kit Date Utils
11 lines (9 loc) • 307 B
text/typescript
import { isValidLocale } from '../isValidLocale';
/**
* Returns the provided locale, or the resolved locale from the Intl object
*/
export const normalizeLocale = (localeStr?: string): string => {
return isValidLocale(localeStr)
? localeStr
: Intl.DateTimeFormat().resolvedOptions().locale;
};