Add a way to make time-moment not use am-time-ago
`am-time-ago` automatically displays a time in the form "3 hours ago". This behaviour is used by the time-moment directive when displaying times from within the last day. This commit adds a way to disable this behaviour and force the actual time/date to be shown. Change-Id: Idfc9113cc818e7e95d874513a81278779c2f1e8a
This commit is contained in:
parent
b61fbb908b
commit
f7f6cfd036
|
@ -28,7 +28,8 @@ angular.module('sb.util').directive('timeMoment',
|
|||
scope: {
|
||||
eventdate: '=',
|
||||
shortDate: '=',
|
||||
formatString: '='
|
||||
formatString: '=',
|
||||
noTimeAgo: '@'
|
||||
},
|
||||
controller: function ($scope) {
|
||||
|
||||
|
@ -36,8 +37,12 @@ angular.module('sb.util').directive('timeMoment',
|
|||
* Helper method to update the needs_timeago propery
|
||||
*/
|
||||
function updateTimeAgo() {
|
||||
$scope.needsTimeAgo =
|
||||
DateUtil.needsTimeAgo($scope.eventdate);
|
||||
if (!$scope.noTimeAgo) {
|
||||
$scope.needsTimeAgo =
|
||||
DateUtil.needsTimeAgo($scope.eventdate);
|
||||
} else {
|
||||
$scope.needsTimeAgo = false;
|
||||
}
|
||||
}
|
||||
|
||||
var unwatch = $scope.$watch(updateTimeAgo);
|
||||
|
|
Loading…
Reference in New Issue