diff --git a/src/js/controller/app/mail-list.js b/src/js/controller/app/mail-list.js index 3e142eb..562ee38 100644 --- a/src/js/controller/app/mail-list.js +++ b/src/js/controller/app/mail-list.js @@ -11,7 +11,7 @@ var INIT_DISPLAY_LEN = 20, FOLDER_TYPE_INBOX = 'Inbox', NOTIFICATION_INBOX_TIMEOUT = 5000; -var MailListCtrl = function($scope, $timeout, $routeParams, statusDisplay, notification, email, keychain, dialog, search, dummy) { +var MailListCtrl = function($scope, $timeout, $routeParams, $filter, statusDisplay, notification, email, keychain, dialog, search, dummy) { // // Init @@ -98,6 +98,20 @@ var MailListCtrl = function($scope, $timeout, $routeParams, statusDisplay, notif } }; + /** + * Date formatting + */ + $scope.formatDate = function(date) { + var now = new Date(); + + // return time if mail is from today + if(now.getDay() === date.getDay() && now.getMonth() === date.getMonth() && now.getFullYear() === date.getFullYear()) { + return $filter('date')(date, 'shortTime'); + } + + return $filter('date')(date, 'mediumDate'); + }; + // // watch tasks // diff --git a/src/tpl/mail-list.html b/src/tpl/mail-list.html index e8df234..0fb3bd0 100644 --- a/src/tpl/mail-list.html +++ b/src/tpl/mail-list.html @@ -61,7 +61,7 @@
- +