node.js – Node + Neo4j driver – is there some way to set up a “global” type convertor so datetime is ISO8601 string instead of JS object?

I’m using node and neo4j.

Dates, like createdAt or sentAt are stored as datetime($now) where now is new Date().toISOString()

However, when I query records from neo4j, the driver returns a JS object.

Now I can of course do new Date(record.createdAt).toISOString() but that is cumbersome.

Is there a way to set up a global typeconverter so that if a record has a datetime property, it is automatically converted and returned as ISO8601 string instead of the JS object by default?

My API consumers expect ISO 8601 strings and I’d like to avoid manual conversion each time.

Thank you

Read more here: Source link