JavaScript - Difference between two dates in days or less I have 2 dates that I would like to have the difference between them in days and if less than a one day simply show "less than a day".

remainingTime() {
  // Scientific notation of 8.64e+7
  const DAY_IN_MILLISECONDS = 8.64 * (10 ** 7);

  const date1 = new Date('2019-02-28T01:22:06.671Z').getTime();
  const date2 = new Date('2019-02-28T04:01:06.671Z').getTime();

  const differenceInMS = date2 - date1;

  const days = Math.floor(differenceInMS / DAY_IN_MILLISECONDS);
  return (days &gt; 1) ? `They have ${days} days` : (days === 1) ? `They have ${days} day` : `you have less than a day left`;
}


Is this way correct if localization is taken into account?

what exactly is the difference between getTime (), getMilliseconds () and getUTCMilliseconds ()?
Your code looks good to me. I think 1000 * 60 * 60 * 24 would be more intuitive than the scientific notation, but either way gets the job done. 

The script doesn't actually take localization into account because Date's getTime method is not localized. To account for time zone, you'd want to get the "timezone offset" of the user's location. (Note that getTimezoneOffset returns a number of minutes, and that number isn't a property of the date object but just an indication of what timezone the code is running in.)

As for the other methods
 - getTime returns the actual "timestamp", a big integer showing how many milliseconds have passed since the 60s ended in London
 - getUTCMilliseconds is just the last three digits of that timestamp (ie how many milliseconds it's been since the last full second since the "epoch", as it's called.)
 - Leaving out the UTC bit (as in getMilliseconds,  or in any of the similar get methods, excepting getTime) makes javascript calculate the local version for you (and in the case of milliseconds, I'd be pretty surprised if it were different from the universal version.)   

...You can see the whole buffet on MDN:
   https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#Date.prototype_Methods