What i want is the possibility to convert the string "5 minutes ago", or the string "10 hours ago" to a javascript date object in an easy manner.
Date.parse expects a date string and i believe that function does not meet my requirements.
In PHP i can do something like this:
Code
$string = "5 minutes ago";
$now = date('Y-m-d H:i:s');
$d = strtotime($now . " + " . str_replace("ago","",$string));
echo "Current time: " . $now;
echo "<br>";
echo "Altered time: " . date('Y-m-d H:i:s',$d);
Output
Current time: 2016-12-03 20:56:33
Altered time: 2016-12-03 21:01:33
and
How can i convert the string "5 minutes ago" or "10 hours ago" into a javascript date object?