lundi 5 juin 2017

AngularJS compare dates wrong

I just wrote this code. It should mark the rows that their dates column has in the past.

This is the code:

        <tr ng-repeat="row in records | orderBy: sortType : sortReverse" ng-class="{past_date:(date | date:'y M d') > (row.oddate | date:'y M d')}">
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>

my app has:

$scope.date = $filter('date')(Date.now(), 'yyyy-MM-dd');//new Date();

every thing works just fine (the past rows was marked) but some other rows marked too! (before 05/06/2017 marked - Good, 06/06/2017 - 08/06/2017 not marked - Good, 11/06/2017-29/06/2017 marked - Problem!, 02/07/2017 and above not marked - Good).

I check and the all of the dates are fine.

What can be the problem??

Thanks!

Aucun commentaire:

Enregistrer un commentaire