So I am currently using the Google Calendar API, specifically the freebusy query (as seen here https://developers.google.com/google-apps/calendar/v3/reference/freebusy/query).
The request body requires a 'timeMin' and 'timeMax'. And here comes my question...
How would I set these two values dynamically based off the current datetime. Basically use the current datetime to set an interval, say an hour before now, and an hour after now.
I have seen other stackoverflow posts (Subtracting hours from date string) on how to setHours by getHours but the problem with this method seems to be that it alters the current time instead of creating a new instance.
Also I need to keep the resulting min and max datetimes in ISOstring format (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) because this is what is used in Google Calendar API request body.