@@ -3,7 +3,7 @@ import { render } from '@testing-library/react'
33import { renderHook } from '@testing-library/react-hooks'
44import React from 'react'
55import { SupportedCalendar } from '../types'
6- import { formatDate } from '../utils'
6+ import { convertToIso8601 , formatDate } from '../utils'
77import localisationHelpers from '../utils/localisationHelpers'
88import { useDatePicker , UseDatePickerReturn } from './useDatePicker'
99
@@ -510,34 +510,21 @@ describe('clicking a day', () => {
510510 }
511511 it ( 'should call the callback with correct info for Gregorian calendar' , ( ) => {
512512 const date = '2018-01-22'
513- const { calendarDate , calendarDateString } = renderForClick ( {
513+ const { calendarDateString } = renderForClick ( {
514514 calendar : 'gregory' ,
515515 date,
516516 } )
517- expect ( calendarDate . toString ( ) ) . toEqual (
518- '2018-01-22T00:00:00+02:00[Africa/Khartoum][u-ca=gregory]'
519- )
520517 expect ( calendarDateString ) . toEqual ( '2018-01-22' )
521518 } )
522519 it ( 'should call the callback with correct info for Ethiopic calendar' , ( ) => {
523520 const date = '2015-13-02'
524- const { calendarDate , calendarDateString } = renderForClick ( {
521+ const { calendarDateString } = renderForClick ( {
525522 calendar : 'ethiopic' ,
526523 date,
527524 } )
528525 expect ( calendarDateString ) . toEqual ( '2015-13-02' )
529- expect (
530- calendarDate . withCalendar ( 'iso8601' ) . toLocaleString ( 'en-GB' )
531- ) . toMatch ( '07/09/2023' )
532-
533- expect (
534- calendarDate . toLocaleString ( 'en-GB' , {
535- month : 'long' ,
536- year : 'numeric' ,
537- day : 'numeric' ,
538- calendar : 'ethiopic' ,
539- } )
540- ) . toEqual ( '2 Pagumen 2015 ERA1' )
526+ const calendarDate = convertToIso8601 ( calendarDateString , 'ethiopic' )
527+ expect ( calendarDate ) . toEqual ( { day : 7 , month : 9 , year : 2023 } )
541528 } )
542529 it ( 'should call the callback with correct info for a custom (Nepali) calendar' , ( ) => {
543530 const date = '2077-12-30'
@@ -548,7 +535,11 @@ describe('clicking a day', () => {
548535 expect ( calendarDateString ) . toEqual ( '2077-12-30' )
549536 expect (
550537 localisationHelpers . localiseMonth (
551- calendarDate ,
538+ {
539+ year : 20777 ,
540+ month : 12 ,
541+ day : 30 ,
542+ } ,
552543 {
553544 locale : 'en-NP' ,
554545 calendar : 'nepali' ,
0 commit comments