Closed LucasBoberg closed 1 year ago
Hey @LucasBoberg,
i've tried to reproduce the issue without success.
Could you check the result of this calls in your chrome and firefox?
const formatter = new Intl.DateTimeFormat('en-US', {
timeZone: 'America/New_York',
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
hour12: false,
era: 'narrow'
})
console.log(formatter.formatToParts(Date.now()))
When using this code:
const driver = neo4j.driver('neo4j://localhost:7687', neo4j.auth.basic('neo4j', 'password'))
driver.executeQuery("RETURN datetime('2023-05-30T01:00:00[America/New_York]') as dt")
.then(({ records: [record] }) => {
console.log('dt', record.get('dt'))
}).finally(async () => driver.close())
It works as expected but my code provided above does not work but still return a value just a wrong one.
The top one being the result from the code in this comment and the one on the bottom being the code provided in the issue.
Bug Report
The datetime() function returns the wrong timezone in node and Chrome but no in Firefox and bun.
Reproduce
Using the following query
On Chrome and node I get the following, which is wrong
On Firefox and bun I get the following, which is correct
The difference is the timeZoneOffsetSeconds which is for some reason different and wrong on Chrome and node
Code for node
```js const neo4j = require('neo4j-driver') const driver = neo4j.driver("neo4j://localhost:7687", neo4j.auth.basic("neo4j", "password")) const session = driver.session() async function run() { try { const result = await session.run( "RETURN datetime('2023-05-30T00:59:00[America/New_York]')" ) const singleRecord = result.records[0] const node = singleRecord.get(0) console.log(node) } finally { await session.close() } // on application exit: await driver.close() } run() ```Code for bun
```js import neo4j from 'neo4j-driver' const driver = neo4j.driver("neo4j://localhost:7687", neo4j.auth.basic("neo4j", "password")) const session = driver.session() async function run() { try { const result = await session.run( "RETURN datetime('2023-05-30T00:59:00[America/New_York]')" ) const singleRecord = result.records[0] const node = singleRecord.get(0) console.log(node) } finally { await session.close() } // on application exit: await driver.close() } run() ```My Environment
Javascript Runtime Version: node v20.3.0, bun 0.6.9, Firefox 114.0.1, Chrome 114 Driver Version: 5.9.1 Neo4j Version and Edition: Neo4j 5.3.0 enterprise Operating System: macOS 10.13.4