import { monthName } from './index' describe('formatting - monthName', () => { const daylightSavingDateTime = '2021-02-28T00:00:00.000Z' // UTC, February const standardDateTime = '2021-07-31T00:00:00.000Z' // UTC, July const long = false const short = true it.each([ ['America/Phoenix', 'en-US', 'February'], ['America/Chicago', 'en-US', 'February'], ['America/New_York', 'en-US', 'February'], ['America/Montevideo', 'es-UY', 'Febrero'], ['America/Sao_Paulo', 'pt-BR', 'fevereiro'], ['UTC', 'en-US', 'February'], ['UTC', 'en-GB', 'February'], ['Europe/London', 'en-GB', 'February'], ['Europe/Paris', 'fr-FR', 'février'], ['Asia/Tbilisi', 'ka-GE', 'თებერვალი'], ['Asia/Kolkata', 'hi-IN', 'फ़रवरी'], ])( 'daylightSavingDateTime - returns correct month, long (TZ: %s, Locale: %s)', (timezone, locale, localisedResult) => expect( monthName(daylightSavingDateTime, long, { timezone, locale }) ).toEqual(localisedResult) ) it.each([ ['America/Phoenix', 'en-US', 'July'], ['America/Chicago', 'en-US', 'July'], ['America/New_York', 'en-US', 'July'], ['America/Montevideo', 'es-UY', 'Julio'], ['America/Sao_Paulo', 'pt-BR', 'julho'], ['UTC', 'en-US', 'July'], ['UTC', 'en-GB', 'July'], ['Europe/London', 'en-GB', 'July'], ['Europe/Paris', 'fr-FR', 'juillet'], ['Asia/Tbilisi', 'ka-GE', 'ივლისი'], ['Asia/Kolkata', 'hi-IN', 'जुलाई'], ])( 'standardDateTime - returns correct month, long (TZ: %s, Locale: %s)', (timezone, locale, localisedResult) => expect(monthName(standardDateTime, long, { timezone, locale })).toEqual( localisedResult ) ) it.each([ ['America/Phoenix', 'en-US', 'Feb'], ['America/Chicago', 'en-US', 'Feb'], ['America/New_York', 'en-US', 'Feb'], ['America/Montevideo', 'es-UY', 'Feb.'], ['America/Sao_Paulo', 'pt-BR', 'fev.'], ['UTC', 'en-US', 'Feb'], ['UTC', 'en-GB', 'Feb'], ['Europe/London', 'en-GB', 'Feb'], ['Europe/Paris', 'fr-FR', 'févr.'], ['Asia/Tbilisi', 'ka-GE', 'თებ'], ['Asia/Kolkata', 'hi-IN', 'फ़र॰'], ])( 'daylightSavingDateTime - returns correct month, short (TZ: %s, Locale: %s)', (timezone, locale, localisedResult) => expect( monthName(daylightSavingDateTime, short, { timezone, locale }) ).toEqual(localisedResult) ) it.each([ ['America/Phoenix', 'en-US', 'Jul'], ['America/Chicago', 'en-US', 'Jul'], ['America/New_York', 'en-US', 'Jul'], ['America/Montevideo', 'es-UY', 'Jul.'], ['America/Sao_Paulo', 'pt-BR', 'jul.'], ['UTC', 'en-US', 'Jul'], ['UTC', 'en-GB', 'Jul'], ['Europe/London', 'en-GB', 'Jul'], ['Europe/Paris', 'fr-FR', 'juil.'], ['Asia/Tbilisi', 'ka-GE', 'ივლ'], ['Asia/Kolkata', 'hi-IN', 'जुल॰'], ])( 'standardDateTime - returns correct month, short (TZ: %s, Locale: %s)', (timezone, locale, localisedResult) => expect(monthName(standardDateTime, short, { timezone, locale })).toEqual( localisedResult ) ) })