Fix display of build timestamp ("44 years ago"...)

This commit is contained in:
Steve Purcell 2013-08-25 11:08:20 +01:00
parent f76802440d
commit 054de9860a
2 changed files with 5 additions and 3 deletions

View file

@ -49,7 +49,7 @@
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<div class="alert alert-success"> <div class="alert alert-success">
<strong>Latest build:</strong> <span ng-controller="BuildStatusCtrl">{{buildStatus.completed | relativeTime}}</span> <strong>Latest build:</strong> <span ng-controller="BuildStatusCtrl">{{completionTime | relativeTime}}</span>
</div> </div>
<a class="twitter-timeline" data-dnt="true" data-related="milkypostman,sanityinc" href="https://twitter.com/melpa_emacs" data-widget-id="311867756586864640">Tweets by @melpa_emacs</a> <a class="twitter-timeline" data-dnt="true" data-related="milkypostman,sanityinc" href="https://twitter.com/melpa_emacs" data-widget-id="311867756586864640">Tweets by @melpa_emacs</a>
</div> </div>

View file

@ -137,7 +137,9 @@
}; };
app.controller('BuildStatusCtrl', function($scope, packageService) { app.controller('BuildStatusCtrl', function($scope, packageService) {
$scope.buildStatus = packageService.buildStatus(); packageService.buildStatus().then(function(status) {
$scope.completionTime = new Date(status.completed * 1000);
});
}); });
app.controller('AppCtrl', function($scope, $rootScope, $route) { app.controller('AppCtrl', function($scope, $rootScope, $route) {
@ -220,7 +222,7 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
app.filter('relativeTime', function() { app.filter('relativeTime', function() {
return function(val) { return function(val) {
return val && moment(new Date(val)).fromNow(); return val && moment(val).fromNow();
}; };
}); });