Invalid timestamp
tttmaximttt opened this issue · 2 comments
-
client library
-
No
-
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
-
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
-
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.
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:
nodejs-bigquery/src/bigquery.ts
Line 2181 in 5e3e540
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 ?