Hey back. I’m 100% it’s not Wappler too but the way we are attempting this isn’t working yet.
Below is the “created_on” datetime field straight from the database, and then the same value with a addHours(1) where 1 is typed static number. Works (even with - negative numbers)
getConsThreadMsgs[0].created_on.addHours(1)
Now instead of a static value, I’m getting a dynamic offset based on the timezone the user is in. I use the free Bing Map API, and all timezone APIs return the offset in this format: X:XX
You pass the query:timezone (ex: America/New_York) and you get information back, including the utcOffetWithDst
For example, for America/New_York the offset comes back accurately to -4:00. Great.
Now when I use that value as dynamic in addHours() it doesn’t add well.
If I leave the value as is, it becomes NaN
If I transform the dynamic value to number, to date, to timestamp, there is no addition (still 9:31)
The quest remains, how to add a dynamic value that comes as “-4:00” (text) so that it can be added to a datetime value.
Maybe stick the value in a variable, and apply some function or straight php to that variable, to then use in the addHours function?
(PS it will need to also work for fractionals (ex: India 4:30) we’ll also need to convert that text to 4.5, before multiplying by 60 and using addMinutes() )