I am working on an HTML file that shows a list of notification messages. I am trying to figure out how to display the time difference between each notification. The code snippet below displays the notifications and includes the time for each one:
<ion-item ng-repeat="single in notifications_list track by $index" class="ng-scope" ng-class="single.read == true ? 'notification-read' : 'notification-unread'" ng-click="displayNotification(single)" style="padding:13px 16px 1px;">
<div class="notifications">
<p style="white-space:normal;font-size:16px;line-height:20px;">{{single.body}}</p>
{{(currentDate - single.time).getDays()}}
<time>{{ single.time | amCalendar:referenceTime:formats }}</time>
</div>
</ion-item>
In my code, I have already set
$rootScope.currentDate = new Date();
Essentially, I want to display the difference in days between two dates like this:
e.g. 2016-05-11T10:30:48.616Z - 2016-05-10T19:14:13.487+08:00
. Can someone guide me on how to achieve this in HTML?
If you have any advice on how I can implement this feature, please let me know. Thank you!