import { yearNumber } from './index' describe('formatting - yearNumber', () => { 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', '2021'], ['America/Chicago', 'en-US', '2021'], ['America/New_York', 'en-US', '2021'], ['America/Montevideo', 'es-UY', '2021'], ['America/Sao_Paulo', 'pt-BR', '2021'], ['UTC', 'en-US', '2021'], ['UTC', 'en-GB', '2021'], ['Europe/London', 'en-GB', '2021'], ['Europe/Paris', 'fr-FR', '2021'], ['Asia/Tbilisi', 'ka-GE', '2021'], ['Asia/Kolkata', 'hi-IN', '2021'], ])( 'daylightSavingDateTime - returns correct month, long (TZ: %s, Locale: %s)', (timezone, locale, localisedResult) => expect( yearNumber(daylightSavingDateTime, long, { timezone, locale }) ).toEqual(localisedResult) ) it.each([ ['America/Phoenix', 'en-US', '2021'], ['America/Chicago', 'en-US', '2021'], ['America/New_York', 'en-US', '2021'], ['America/Montevideo', 'es-UY', '2021'], ['America/Sao_Paulo', 'pt-BR', '2021'], ['UTC', 'en-US', '2021'], ['UTC', 'en-GB', '2021'], ['Europe/London', 'en-GB', '2021'], ['Europe/Paris', 'fr-FR', '2021'], ['Asia/Tbilisi', 'ka-GE', '2021'], ['Asia/Kolkata', 'hi-IN', '2021'], ])( 'standardDateTime - returns correct month, long (TZ: %s, Locale: %s)', (timezone, locale, localisedResult) => expect(yearNumber(standardDateTime, long, { timezone, locale })).toEqual( localisedResult ) ) it.each([ ['America/Phoenix', 'en-US', '21'], ['America/Chicago', 'en-US', '21'], ['America/New_York', 'en-US', '21'], ['America/Montevideo', 'es-UY', '21'], ['America/Sao_Paulo', 'pt-BR', '21'], ['UTC', 'en-US', '21'], ['UTC', 'en-GB', '21'], ['Europe/London', 'en-GB', '21'], ['Europe/Paris', 'fr-FR', '21'], ['Asia/Tbilisi', 'ka-GE', '21'], ['Asia/Kolkata', 'hi-IN', '21'], ])( 'daylightSavingDateTime - returns correct month, short (TZ: %s, Locale: %s)', (timezone, locale, localisedResult) => expect( yearNumber(daylightSavingDateTime, short, { timezone, locale }) ).toEqual(localisedResult) ) it.each([ ['America/Phoenix', 'en-US', '21'], ['America/Chicago', 'en-US', '21'], ['America/New_York', 'en-US', '21'], ['America/Montevideo', 'es-UY', '21'], ['America/Sao_Paulo', 'pt-BR', '21'], ['UTC', 'en-US', '21'], ['UTC', 'en-GB', '21'], ['Europe/London', 'en-GB', '21'], ['Europe/Paris', 'fr-FR', '21'], ['Asia/Tbilisi', 'ka-GE', '21'], ['Asia/Kolkata', 'hi-IN', '21'], ])( 'standardDateTime - returns correct month, short (TZ: %s, Locale: %s)', (timezone, locale, localisedResult) => expect(yearNumber(standardDateTime, short, { timezone, locale })).toEqual( localisedResult ) ) })