This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +14
-1
lines changed
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -320,7 +320,7 @@ dateFilter.$inject = ['$locale'];
320
320
function dateFilter ( $locale ) {
321
321
322
322
323
- var R_ISO8601_STR = / ^ ( \d { 4 } ) - ? ( \d \d ) - ? ( \d \d ) (?: T ( \d \d ) (?: : ? ( \d \d ) (?: : ? ( \d \d ) (?: \. ( \d { 3 } ) ) ? ) ? ) ? ( Z | ( [ + - ] ) ( \d \d ) : ? ( \d \d ) ) ) ? $ / ;
323
+ var R_ISO8601_STR = / ^ ( \d { 4 } ) - ? ( \d \d ) - ? ( \d \d ) (?: T ( \d \d ) (?: : ? ( \d \d ) (?: : ? ( \d \d ) (?: \. ( \d + ) ) ? ) ? ) ? ( Z | ( [ + - ] ) ( \d \d ) : ? ( \d \d ) ) ) ? $ / ;
324
324
function jsonStringToDate ( string ) {
325
325
var match ;
326
326
if ( match = string . match ( R_ISO8601_STR ) ) {
Original file line number Diff line number Diff line change @@ -270,5 +270,18 @@ describe('filters', function() {
270
270
//no time
271
271
expect ( date ( '2003-09-10' , format ) ) . toEqual ( '2003-09 00' ) ;
272
272
} ) ;
273
+
274
+ it ( 'should support different degrees of subsecond precision' , function ( ) {
275
+ var format = 'yyyy-MM-dd' ;
276
+
277
+ expect ( date ( '2003-09-10T13:02:03.12345678Z' , format ) ) . toEqual ( '2003-09-10' ) ;
278
+ expect ( date ( '2003-09-10T13:02:03.1234567Z' , format ) ) . toEqual ( '2003-09-10' ) ;
279
+ expect ( date ( '2003-09-10T13:02:03.123456Z' , format ) ) . toEqual ( '2003-09-10' ) ;
280
+ expect ( date ( '2003-09-10T13:02:03.12345Z' , format ) ) . toEqual ( '2003-09-10' ) ;
281
+ expect ( date ( '2003-09-10T13:02:03.1234Z' , format ) ) . toEqual ( '2003-09-10' ) ;
282
+ expect ( date ( '2003-09-10T13:02:03.123Z' , format ) ) . toEqual ( '2003-09-10' ) ;
283
+ expect ( date ( '2003-09-10T13:02:03.12Z' , format ) ) . toEqual ( '2003-09-10' ) ;
284
+ expect ( date ( '2003-09-10T13:02:03.1Z' , format ) ) . toEqual ( '2003-09-10' ) ;
285
+ } ) ;
273
286
} ) ;
274
287
} ) ;
You can’t perform that action at this time.
0 commit comments