@@ -111,6 +111,15 @@ describe('string conversion', function () {
111
111
expect ( ( ) => parseDate ( '2020-02-30' ) ) . toThrow ( ) ;
112
112
expect ( ( ) => parseDate ( '2024-01-00' ) ) . toThrow ( ) ;
113
113
} ) ;
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
+ } ) ;
114
123
} ) ;
115
124
116
125
describe ( 'CalendarDate#toString' , function ( ) {
@@ -195,6 +204,15 @@ describe('string conversion', function () {
195
204
expect ( ( ) => parseDateTime ( '2020-02-03T23:99' ) ) . toThrow ( ) ;
196
205
expect ( ( ) => parseDateTime ( '2020-02-03T12:22:99' ) ) . toThrow ( ) ;
197
206
} ) ;
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
+ } ) ;
198
216
} ) ;
199
217
200
218
describe ( 'CalendarDateTime#toString' , function ( ) {
0 commit comments