Date in database is considered as String in front-end
You're mixing up a JavaScript Date object with an ISO Date string. When you save to the database, it does become a string. You have to convert the date string back into a javascript date object before you can use the getTime() method. Try:
var myDate = new Date(dateStringFromDatabase);console.log(myDate.getTime());