While testing my program I noticed that, while the date works well on Chrome and it gives me a valid one, for Firefox I receive an Invalid Date while trying to run the following code:
var dateToConvert = $filter('date')(resourcehelper.getLocalDate(jm.logging.subordinatedElements[i].logTime), 'yyyy-MM-dd HH:mm:ss:sss');
var dateWithDifference = moment(dateToConvert).subtract(hourDifference, 'hours').format('YYYY-MM-DD HH:mm:ss:SSS');
Where "jm.logging.subordinatedElements[i].logTime" is a date which is equal to an unix format like this one: 1545092400027
The "hourDifference" variable is calculated like this:
var differenceOfHours = moment.utc(moment(localDate, 'YYYY-MM-DD HH:mm:ss:SSS').diff(moment(serverDate, 'YYYY-MM-DD HH:mm:ss:SSS'))).format("HH");
return parseInt(differenceOfHours);
Where both the localDate and the serverDate have the following format: "2018-12-18 02:20:00:043". The hourDifference always gives me "00", and 0 after parseInt, no matter the hour difference between two dates, on firefox.
While all of this works on Chrome without problems, as I said they don't do in firefox. My question is, how should I make my date be recognizable without changing the "2018-12-18 02:20:00:043" format? (since I must display the date in this format to the final user).