This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -320,7 +320,7 @@ dateFilter.$inject = ['$locale'];
320320function dateFilter ( $locale ) {
321321
322322
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 ) ) ) ? $ / ;
324324 function jsonStringToDate ( string ) {
325325 var match ;
326326 if ( match = string . match ( R_ISO8601_STR ) ) {
Original file line number Diff line number Diff line change @@ -270,5 +270,18 @@ describe('filters', function() {
270270 //no time
271271 expect ( date ( '2003-09-10' , format ) ) . toEqual ( '2003-09 00' ) ;
272272 } ) ;
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+ } ) ;
273286 } ) ;
274287} ) ;
You can’t perform that action at this time.
0 commit comments