Javascript can be a bit difficult to work with time without a library but heres two simple ways to check a date.
This example shows checking if myDate
is more than an hour from the current time.
var oneHour = 60 * 60 * 1000;
if((new(Date) - myDate) > oneHour){
// do work
}
Another example is to get the time one hour from the current time.
var oneHour = 60 * 60 * 1000;
new Date(new(Date) + oneHour);
Related External Links: