googleapis/nodejs-bigquery

Invalid timestamp

tttmaximttt opened this issue · 2 comments

  1. client library

  2. No

  3. No

Environment details

  • OS: Ventura 13.6
  • Node.js version: v18.15.0
  • npm version: 9.5.0
  • @google-cloud/bigquery version: 6.2.1

Steps to reproduce

  1. Create timestamp in BQ by native client or manualy not using this lib. You should see something like this 2022-10-19 12:01:00.184708 UTC
    Screenshot 2023-10-06 at 22 11 49

  2. Try to get some data with that timestamp and you will get this 2022-10-19T12:01:00.184708000Z with additional 000 thats invalid timestamp and cant be used.

Screenshot 2023-10-06 at 22 16 43

Thanks!

@tttmaximttt I ran some tests here and that timestamp is being return with microseconds resolution. It comes from the backend as a Float and we parse it using the @google-cloud/precise-date package. You can use that package to have more parsing options, but doing a new Date('2022-10-19T13:01:00.184708000Z') also works just fine for parsing that timestamp.

You can see the parsing code here:

export class BigQueryTimestamp {

Are you having a more specific issue ? If you can share more on how you're trying to parse it I can provide some guidance.

Btw, I've just noticed that you reported the version that you've tested. Microsecond precision date support landed on v7.3.0, so is it possible for you to update to a more recent version of our client ?