@@ -244,14 +244,6 @@ describe('NepaliDate', () => {
244
244
expect ( n . getEnglishDate ( ) ) . toBe ( 11 )
245
245
expect ( n . getDay ( ) ) . toBe ( 6 )
246
246
} )
247
-
248
- it ( "should return minimum date 1944 of Nepal's time" , ( ) => {
249
- expect ( NepaliDate . minimum ( ) . toISOString ( ) ) . toEqual ( '1943-12-31T18:30:00.000Z' )
250
- } )
251
-
252
- it ( "should return maximum date 2042 Dec last of Nepal's time" , ( ) => {
253
- expect ( NepaliDate . maximum ( ) . toISOString ( ) ) . toEqual ( '2042-12-30T18:15:00.000Z' )
254
- } )
255
247
} )
256
248
257
249
describe ( 'NepaliDate parsing on initialization' , ( ) => {
@@ -787,3 +779,60 @@ describe('NepaliDate.getDaysOfMonth', () => {
787
779
)
788
780
} )
789
781
} )
782
+
783
+ describe ( 'NepaliDate min max supported dates' , ( ) => {
784
+ it ( 'minSupportedDate should return the minimum English Date converted to Nepali Date' , ( ) => {
785
+ const result = NepaliDate . minSupportedDate ( )
786
+
787
+ expect ( result ) . toBeInstanceOf ( Date )
788
+ expect ( result . toISOString ( ) ) . toEqual ( '1943-12-31T18:30:00.000Z' ) // comparing UTC time
789
+ } )
790
+
791
+ it ( 'maxSupportedDate should return the maximum English Date converted to Nepali Date' , ( ) => {
792
+ const result = NepaliDate . maxSupportedDate ( )
793
+
794
+ expect ( result ) . toBeInstanceOf ( Date )
795
+ expect ( result . toISOString ( ) ) . toEqual ( '2042-12-30T18:15:00.000Z' ) // comparing UTC time
796
+ } )
797
+
798
+ it ( 'minSupportedNepaliDate should return the minimum NepaliDate object' , ( ) => {
799
+ const expectedYear = dateConverter . npMinYear ( )
800
+ const result = NepaliDate . minSupportedNepaliDate ( )
801
+
802
+ expect ( result ) . toBeInstanceOf ( NepaliDate )
803
+ expect ( result . getYear ( ) ) . toBe ( expectedYear )
804
+ expect ( result . getMonth ( ) ) . toBe ( 0 )
805
+ expect ( result . getDate ( ) ) . toBe ( 1 )
806
+ } )
807
+
808
+ it ( 'maxSupportedNepaliDate should return the maximum NepaliDate object' , ( ) => {
809
+ const expectedYear = dateConverter . npMaxYear ( )
810
+ const expectedMonth = 11
811
+ const expectedDays = NepaliDate . getDaysOfMonth ( expectedYear , expectedMonth )
812
+
813
+ const result = NepaliDate . maxSupportedNepaliDate ( )
814
+
815
+ expect ( result ) . toBeInstanceOf ( NepaliDate )
816
+ expect ( result . getYear ( ) ) . toBe ( expectedYear )
817
+ expect ( result . getMonth ( ) ) . toBe ( expectedMonth )
818
+ expect ( result . getDate ( ) ) . toBe ( expectedDays )
819
+ } )
820
+
821
+ it ( "should return minimum date 1944 of Nepal's time" , ( ) => {
822
+ const originalWarn = console . warn
823
+ console . warn = ( ) => { } // hide deprecation warning
824
+ expect ( NepaliDate . minimum ( ) . toISOString ( ) ) . toEqual (
825
+ NepaliDate . minSupportedDate ( ) . toISOString ( )
826
+ )
827
+ console . warn = originalWarn
828
+ } )
829
+
830
+ it ( "should return maximum date 2042 Dec last of Nepal's time" , ( ) => {
831
+ const originalWarn = console . warn
832
+ console . warn = ( ) => { } // hide deprecation warning
833
+ expect ( NepaliDate . maximum ( ) . toISOString ( ) ) . toEqual (
834
+ NepaliDate . maxSupportedDate ( ) . toISOString ( )
835
+ )
836
+ console . warn = originalWarn
837
+ } )
838
+ } )
0 commit comments