All files / app/locale createLocaleContext.ts

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21149x   149x     149x 607x       607x   607x                
import { createCurrencyService, StoreConfig } from '@bigcommerce/checkout-sdk';
 
import getLanguageService from './getLanguageService';
import { LocaleContextType } from './LocaleContext';
 
export default function createLocaleContext(config: StoreConfig): Required<LocaleContextType> {
    Iif (!config) {
        throw new Error('Missing configuration data');
    }
 
    const { inputDateFormat } = config;
 
    return {
        currency: createCurrencyService(config),
        date: {
            inputFormat: inputDateFormat,
        },
        language: getLanguageService(),
    };
}