Skip to content

DateTime and temporal usage  #394

Closed
Closed
@noumaans

Description

@noumaans

Trying to use temporal types, and running into few issues.

The following code is trying to convert parameter which needs to be passed onto session.run:

    const value = new Date();
    const newValue = new neo4j.DateTime( // also tried neo4j.v1.DateTime, neo4j.temporal.DateTime
      value.getFullYear(),
      value.getMonth(),
      value.getDay(),
      value.getHours(),
      value.getMinutes(),
      value.getSeconds(),
      value.getMilliseconds() * 1000000,  // nanoseconds
      value.getTimezoneOffset() * 60      // seconds
    );

   session.run(cypher, {updated: newValue}) // store current date on save

I've tried the following approaches to import neo4j driver:

import {v1 as neo4j} from 'neo4j-driver';
import neo4j from 'neo4j-driver';

The errors raised on the conversion are of these types:
_neo4jDriver2.default.temporal.DateTime is not a constructor
Cannot read property 'temporal' of undefined
Cannot read property 'DateTime' of undefined
_neo4jDriver.v1.DateTime is not a constructor

I can access other methods such as .isInt() without any issues.

Version Info:

 $ grep 'resolved.*neo4j-driver' package-lock.json 
      "resolved": "https://registry.npmjs.org/neo4j-driver/-/neo4j-driver-1.6.1.tgz",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions