[thin] - Shifted TIMESTAMP_LTZ when dbtimezone is other than UTC
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
const {rows: [[date]]} = SELECT CAST( TIMESTAMP '2026-07-20 15:00:00 America/New_York' AS TIMESTAMP WITH LOCAL TIME ZONE) FROM dual;
console.log(date);
Expected: 2026-07-20T19:00:00.000Z
We will get this result both: in thick mode and in thin mode when database timezone is set to UTC. On differently configured databases ex.:
ALTER DATABASE SET TIME_ZONE = '+03:00';
SHUTDOWN IMMEDIATE;
STARTUP;
it will be 2026-07-20T22:00:00.000Z.
It seems to me that adopted in parseOracleDate assumption:
Time zone information is discarded because Node.js uses UTC timestamps and the server returns the data in that format, too.
should have an ending: For Timestamp LTZ data are transmited "on wire" in dbtimezone offset.
When you pass to makeDate dbtimezone offset instead of zero:
https://github.com/oracle/node-oracledb/blob/b7d957d6720ca106e639793aba6b659bfe3b0119/lib/impl/datahandlers/buffer.js#L187-L188
let offset = 0;
if (!useLocalTime && buf.length < 13) {
offset = 180;
}
return nodbUtil.makeDate(useLocalTime, year, buf[2], buf[3], buf[4] - 1,
buf[5] - 1, buf[6] - 1, fseconds, offset);
The result will be correct.
Solving the problem does not seem to be easy because Buffer and the Connection do not seem to have information about the database time zone. If you have access to the protocol documentation, you may find a simple workaround (forcing the server to send UTC).
- What versions are you using?
7.0.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with lib/impl/datahandlers/buffer.js, reading parseOracleDate and the nodbUtil.makeDate call, then run the supplied TIMESTAMP WITH LOCAL TIME ZONE query against a database whose time zone is not UTC. Investigate how the Buffer and Connection obtain database time-zone information or whether the protocol can request UTC; done means the query produces 2026-07-20T19:00:00.000Z in thin mode regardless of database time zone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100