mark the current month as recent

This commit is contained in:
Marty Alcala 2016-11-02 17:01:32 -04:00
parent e41b46b42d
commit 19554b94b6
2 changed files with 20 additions and 5 deletions

View File

@ -153,7 +153,8 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
};
$scope.getDate = function(txCreated) {
return new Date(txCreated * 1000);
var date = new Date(txCreated * 1000);
return date;
};
$scope.showGroupHeader = function(index) {
@ -168,9 +169,16 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
function createdDuringSameMonth(tx1, tx2) {
var date1 = new Date(tx1.time * 1000);
var date2 = new Date(tx2.time * 1000);
var date1MonthYear = date1.getMonth() + date1.getFullYear();
var date2MonthYear = date2.getMonth() + date2.getFullYear();
return date1MonthYear === date2MonthYear;
return getMonthYear(date1) === getMonthYear(date2);
}
$scope.isDateInCurrentMonth = function(date) {
var now = new Date();
return getMonthYear(now) === getMonthYear(date);
};
function getMonthYear(date) {
return date.getMonth() + date.getFullYear();
}
$scope.showMore = function() {

View File

@ -176,7 +176,14 @@
<div class="wallet-details__list" ng-show="txHistory[0]">
<div ng-repeat="btx in txHistory track by $index" ng-click="openTxModal(btx)">
<div class="wallet-details__group-label" ng-if="showGroupHeader($index)">{{getDate(btx.time) | date:'MMMM'}}</div>
<div class="wallet-details__group-label" ng-if="showGroupHeader($index)">
<span ng-if="isDateInCurrentMonth(getDate(btx.time))">
Recent
</span>
<span ng-if="!isDateInCurrentMonth(getDate(btx.time))">
{{getDate(btx.time) | date:'MMMM'}}
</span>
</div>
<div class="wallet-details__item">
<img class="wallet-details__tx-icon" src="img/icon-tx-received.svg" width="40" ng-if="btx.action == 'received'">