I have data coming from an API which formats what should be a datetime object as a string. So the format is: "2021-04-22 19:32:00".
I have a start date and end date in this format.
Since it's a string, using JavaScript to pull out the hours isn't challenging, but I'm wondering, now that I have my two string variables of a theoretical begin and end time, how do I calculate how difference in these two parameters.
Meaning:
object 1 start time would be : "18:30:00". object 2 end time would be : "20:00:00".
And I want to know that difference is 90 minutes...
for this to work in safari you need to add a T to the middle to create a valid date
console.log(new Date("2021-04-22 19:32:00".replace(/ /,"T")))