1
0
mirror of https://github.com/moparisthebest/mail synced 2024-12-24 00:08:48 -05:00

add moment to format date

This commit is contained in:
Tankred Hase 2013-09-05 10:59:55 +02:00
parent 6d3f7dcd47
commit e93407f478
4 changed files with 25 additions and 10 deletions

View File

@ -1,7 +1,8 @@
define(function(require) { define(function(require) {
'use strict'; 'use strict';
var appController = require('js/app-controller'); var appController = require('js/app-controller'),
moment = require('moment');
var MessageListCtrl = function($scope) { var MessageListCtrl = function($scope) {
$scope.folderName = 'Inbox'; $scope.folderName = 'Inbox';
@ -10,12 +11,7 @@ define(function(require) {
$scope.selected = email; $scope.selected = email;
}; };
fetchList(function(err, emails) { fetchList(function(emails) {
if (err) {
console.log(err);
return;
}
$scope.emails = emails; $scope.emails = emails;
$scope.$apply(); $scope.$apply();
}); });
@ -32,7 +28,19 @@ define(function(require) {
folder: 'INBOX', folder: 'INBOX',
offset: -6, offset: -6,
num: 0 num: 0
}, callback); }, function(err, emails) {
if (err) {
console.log(err);
return;
}
emails.forEach(function(email) {
// set display date
email.displayDate = moment(email.sentDate).format('DD.MM.YY');
});
callback(emails);
});
}); });
} }

6
src/lib/moment.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -17,7 +17,8 @@
SmtpClient: 'smtp-client-browserified', SmtpClient: 'smtp-client-browserified',
angular: 'angular/angular.min', angular: 'angular/angular.min',
angularRoute: 'angular/angular-route.min', angularRoute: 'angular/angular-route.min',
angularTouch: 'angular/angular-touch.min' angularTouch: 'angular/angular-touch.min',
moment: 'moment.min'
}, },
shim: { shim: {
angular: { angular: {

View File

@ -16,7 +16,7 @@
<p class="from">{{email.from[0].name}}</p> <p class="from">{{email.from[0].name}}</p>
<p class="subject-line"> <p class="subject-line">
<span class="subject">{{email.subject}}</span> <span class="subject">{{email.subject}}</span>
<span class="sent-date">{{email.sentDate}}</span> <span class="sent-date">{{email.displayDate}}</span>
</p> </p>
<p class="text-preview">{{email.body}}</p> <p class="text-preview">{{email.body}}</p>
</li> </li>