@@ -111,6 +111,15 @@ describe('string conversion', function () {
111111 expect ( ( ) => parseDate ( '2020-02-30' ) ) . toThrow ( ) ;
112112 expect ( ( ) => parseDate ( '2024-01-00' ) ) . toThrow ( ) ;
113113 } ) ;
114+
115+ it ( 'should provide helpful error when passed an absolute datetime string' , function ( ) {
116+ expect ( ( ) => parseDate ( '2023-10-07T12:34:56.789Z' ) ) . toThrow ( / p a r s e A b s o l u t e / ) ;
117+ const isoString = new Date ( '2023-10-07T12:00:00Z' ) . toISOString ( ) ;
118+ expect ( ( ) => parseDate ( isoString ) ) . toThrow ( / p a r s e A b s o l u t e / ) ;
119+ expect ( ( ) => parseDate ( '2020-02-03T12:23:24Z' ) ) . toThrow ( / p a r s e A b s o l u t e / ) ;
120+ expect ( ( ) => parseDate ( '2020-02-03T12:23:24+05:00' ) ) . toThrow ( / p a r s e A b s o l u t e / ) ;
121+ expect ( ( ) => parseDate ( '2020-02-03T12:23:24-08:00' ) ) . toThrow ( / p a r s e A b s o l u t e / ) ;
122+ } ) ;
114123 } ) ;
115124
116125 describe ( 'CalendarDate#toString' , function ( ) {
@@ -195,6 +204,15 @@ describe('string conversion', function () {
195204 expect ( ( ) => parseDateTime ( '2020-02-03T23:99' ) ) . toThrow ( ) ;
196205 expect ( ( ) => parseDateTime ( '2020-02-03T12:22:99' ) ) . toThrow ( ) ;
197206 } ) ;
207+
208+ it ( 'should provide helpful error when passed an absolute datetime string' , function ( ) {
209+ expect ( ( ) => parseDateTime ( '2023-10-07T12:34:56.789Z' ) ) . toThrow ( / p a r s e A b s o l u t e / ) ;
210+ const isoString = new Date ( '2023-10-07T12:00:00Z' ) . toISOString ( ) ;
211+ expect ( ( ) => parseDateTime ( isoString ) ) . toThrow ( / p a r s e A b s o l u t e / ) ;
212+ expect ( ( ) => parseDateTime ( '2020-02-03T12:23:24Z' ) ) . toThrow ( / p a r s e A b s o l u t e / ) ;
213+ expect ( ( ) => parseDateTime ( '2020-02-03T12:23:24+05:00' ) ) . toThrow ( / p a r s e A b s o l u t e / ) ;
214+ expect ( ( ) => parseDateTime ( '2020-02-03T12:23:24-08:00' ) ) . toThrow ( / p a r s e A b s o l u t e / ) ;
215+ } ) ;
198216 } ) ;
199217
200218 describe ( 'CalendarDateTime#toString' , function ( ) {
0 commit comments