How to subtract a date from current date in AngularJS
<p>I am trying to calculate experience of an employee in my application. I was planning to do so by subtracting 'careerStartedOn' from the 'Current date'.</p>

<p>Here's my code for controller :</p>

<pre><code>myApp.controller('getAllBenchersController', ['$scope', 'employeeTalentPoolServices', 'dataTable', '$window', '$timeout', function ($scope, employeeTalentPoolServices, dataTable, $window, $timeout) {
    employeeTalentPoolServices.getAllBenchers().then(function (result) {
     var mainData = result.data;
        $scope.date = new Date();
         $scope.blockEmployee = function (id) {

            employeeTalentPoolServices.blockEmployee(id);
            $scope.showhide = false;
        }
         });

    employeeTalentPoolServices.getCustomerAccounts().then(function (result) {
        $scope.accountData = result.data;
        });

}]);
</code></pre>

<p>Html :</p>

<pre><code>&lt;div class="widget-content table-container" ng-controller="getAllBenchersController"&gt;
&lt;table ng-table="talentPoolList" show-filter="true" class="table table-striped table-bordered"&gt;
                    &lt;tr ng-repeat="employee in data"&gt;
      &lt;td data-title="'Experience'" sortable="'Experience'" filter="{ 'account': 'text' }"&gt;
                         {{employee.careerStartedOn | date:myApp.dateFormat}}
                        &lt;/td&gt;
    &lt;/tr&gt;
                &lt;/table&gt;
</code></pre>

<p>in HTML, if i call <code>{{employee.careerStartedOn | date:myApp.dateFormat}}</code> i will get the 'careerStartedOn' date and when i call <code>{{date | date:myApp.dateFormat}}</code> i will get the current date.</p>

<p>I need to substract the <strong>careerStartedOn</strong> date from the current <strong>date</strong> and then display it in the <code>&lt;td&gt;</code>. I am a fresher and cant find a solution to do this.</p>

<p>Can anyone help me out with the code to achieve this?</p>

<p>Thanks in advance...</p>