snap-cloud / SnapSite

[DEPRECATED] The old social website for the Snap! programming language/environment
GNU General Public License v3.0
9 stars 18 forks source link

Convert SQL Time to ISO 8601, Safari Time Support #112

Open ochan1 opened 3 years ago

ochan1 commented 3 years ago

Safari had a problem supporting the time format outputted by the SQL Server through Lua

Safari's JavaScript interpreter for the Date class doesn't support the SQL Server format: YYYY-MM-DD HH:MM:SS-TZ:tz (where TZ:tz is Hour and Minutes of Time Zone)

We can luckily convert this time to the ISO 8601 time string format easily: YYYY-MM-DDTHH:MM:SS-TZ:tz, where "T" is between the date and time+timezone in the string

We replace the first space in the time string with "T", which is between the date and time+timezone in the string

There's no expectation for the user to modify this or any other part of the code to modify this, so the input format can be assumed to be the same

ochan1 commented 3 years ago

Verified new changes They work on the Safari browser and show the dates correctly