( If you are using grunt, run grunt serve and it will automatically add these scripts, since you are using --save during bower install )
Add module angularMoment to Your app.
var myapp = angular.module('myapp', ['angularMoment']);
Now you can use momentjs in your controllers.
Your problem is to find it one point in time is before or after now in a specified time ( 45 mins ). It seems to me that imagine you have circle with radius. Radius is 45 mins and now is in the middle of circle. Then everything inside this circle is fine and everything outside is wrong.
You also want to know if something is in past, so is on a left side of a circle.
So lets assume that middle is algebraic 0.
n is circle radius. ( 45 mins )
If t is argument ( given time ), then to check if it is inside:
f(t) = n - t
if f(t) is between 0 and t then it belongs on a right side.
if f(t) is between t and 2t then it belonds and in on left side ( past ).
With this preparation, time to implement in momentjs:
Asked in February 2016Viewed 2,527 timesVoted 14Answered 2 times