JSFiddle - React, Tailwind, and code Playground

by Nibin George

JavaScript

var string = "06/25/2018 12:45 PM (10 days ago)";
var formattedDateTimeString =  string.replace(/ *\([^)]*\) */g, "");

    var EstimatedNextLoginDateObj = new Date(formattedDateTimeString);
        var currentDate = new Date()
    var diffMs = (EstimatedNextLoginDateObj - currentDate); 
    var diffMins = Math.floor((diffMs/1000)/60);
    /* var timeDiff = Math.abs(EstimatedNextLoginDateObj.getTime() - currentDate.getTime());
    var diffMins = Math.ceil(timeDiff / (1000 * 3600)); */
    console.log(EstimatedNextLoginDateObj, currentDate, diffMins);