File tree 2 files changed +14
-4
lines changed
2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -172,14 +172,14 @@ function orderByFilter($parse) {
172
172
173
173
function objectToString ( value ) {
174
174
if ( value === null ) return 'null' ;
175
- if ( typeof value . toString === 'function' ) {
176
- value = value . toString ( ) ;
177
- if ( isPrimitive ( value ) ) return value ;
178
- }
179
175
if ( typeof value . valueOf === 'function' ) {
180
176
value = value . valueOf ( ) ;
181
177
if ( isPrimitive ( value ) ) return value ;
182
178
}
179
+ if ( typeof value . toString === 'function' ) {
180
+ value = value . toString ( ) ;
181
+ if ( isPrimitive ( value ) ) return value ;
182
+ }
183
183
return '' ;
184
184
}
185
185
Original file line number Diff line number Diff line change @@ -79,6 +79,16 @@ describe('Filter: orderBy', function() {
79
79
{ a :new Date ( '01/01/2014' ) , b :3 } ] ) ;
80
80
} ) ;
81
81
82
+ it ( 'should compare timestamps when sorting dates' , function ( ) {
83
+ expect ( orderBy ( [
84
+ new Date ( '01/01/2015' ) ,
85
+ new Date ( '01/01/2014' )
86
+ ] ) ) . toEqualData ( [
87
+ new Date ( '01/01/2014' ) ,
88
+ new Date ( '01/01/2015' )
89
+ ] ) ;
90
+ } ) ;
91
+
82
92
83
93
it ( 'should use function' , function ( ) {
84
94
expect (
You can’t perform that action at this time.
0 commit comments