I am trying to come up with a simple solution to:

current date - indicated date with format “January 4, 2018” = years and months since the indicated date.

I looked at the Datejs but I was unable to figure out how to use it to do a simple math date calculation.

I came up with this but I am not sure if this is the way to go. Suggestions are welcomed.

```
var dPast = 'January 4, 2018'
var d1 = new Date(); //"now"
var d2 = new Date(dPast);
var dCalc = Math.abs((d1-d2)/31556952000); // difference in milliseconds
var diff = Math.round(10 * dCalc)/10; // difference in years rounded to tenth
alert('It has been ' + diff + ' years since ' + dPast);
```

**Edit: Solved.** Here is a solution that I got from a Reddit user:

```
var dPast = 'January 4, 2018'
var d1 = new Date(); //"now"
var d2 = new Date(dPast);
var years = d1.getYear() - d2.getYear()
var months = d1.getMonth() - d2.getMonth()
alert(`It has been ${years} years and ${months} months`)
```