Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-moment/0.10.1/angular-moment.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body ng-app="app">
  
  <div ng-controller="ctrl">
    <time>Date: {{year}}. <strong>Years ago: {{year | straightUpYear}}</strong></time>
  </div>
</body>
</html>
 
var deps = ['angularMoment'];
var app  = angular.module('app', deps);
app.controller('ctrl', function ($scope) {
  $scope.year = '1990-01-01';
});
app.filter('straightUpYear', function (amTimeAgoFilter) {
      return function (value) {
        return amTimeAgoFilter(value, false, true).replace(/years/, '');
      };
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers