Export FaunaTime in FaunaDB JS Driver

Hi Folks,

I have to work with Fauna times in my app but for this, I need to have access to the FaunaTime class to make some checks like

if (value instanceof FaunaTime) { ... }

Thank you.

You should be already able to do this:

const { values } = require('faunadb')

const d = new values.FaunaTime(new Date())

console.log(d instanceof values.FaunaTime) // true

EDIT: confirmed working with results from queries. It’s a rif on one of the tests in the js driver.

const { query: q, values } = require('faunadb')

const client = new Client({ secret: MY_SECRET })
client
  .query(q.Time('now'))
  .then((result) => console.log(result instanceof values.FaunaTime))
  .catch((e) => console.error('Error: %s', e))

// true
1 Like

That is true. Thank you.

1 Like