Open darkpixel opened 2 years ago
So I basically have to use moment-timezone to grab the time from the database, rip the timezone information off, and replace it with the local timezone of the database...then allow moment to convert it back to UTC to properly store it in a "real" (non-Sybase) database.
Looks like here: https://github.com/rodhoward/node-sybase/blob/407f47d014660a759cfb213ed2e91010ec11ccb4/JavaSybaseLink/src/SybaseDB.java#L51
You assume the database is in the UTC timezone. (UTZ is not a timezone, it is a time standard. GMT is the timezone.) Anyways, some Sybase databases don't store timezone information. They just automatically assume the times are in whatever timezone the database is running under. This means for any database on a server running anywhere other than GMT might get the wrong timezone info.
I think the easiest fix is to allow passing a timezone parameter into the SybaseDB function.
I'm not exactly sure where the problem lies, but I'm guessing it's in the Java part of the library...
Anyways, I deal with a Sybase database that has a bunch of dates...and the dates have no timezone information.
i.e. '2022-01-17T00:18:42'...but the results I get back from node-sybase are: 2022-01-17T00:18:42Z.
Notice the 'Z' on the end? It's suppose to indicate time in GMT. Apparently something deep in the bowels of this library decides to stamp any local time as being GMT...even when the database might reside in a different timezone (such as America/Los_Angeles).