Issue Summary:
The latest version (7.5.0) of the Node.js Google BigQuery Client Library has introduced a breaking change in the timestamp representation. The library has switched from the previous representation, where timestamps could be created as numbers using new BigQueryTimestamp(Date.now() / 1000), to a new representation using int64 microseconds. This change results in incorrect dates when creating BigQueryTimestamps using the previous method, and now requires multiplying the timestamp by 1000 to obtain the correct date.
Steps to Reproduce:
Install or update the library to version 7.4.0.
Attempt to create a BigQueryTimestamp using the old method: new BigQueryTimestamp(Date.now() / 1000).
Then update to 7.5.0
Attempt to create a BigQueryTimestamp using the old method: new BigQueryTimestamp(Date.now() / 1000).
Expected Behavior:
The expected behavior is that creating a BigQueryTimestamp using new BigQueryTimestamp(Date.now() / 1000) should result in the correct date representation.
Actual Behavior:
The actual behavior is that the timestamp representation has changed, and creating a BigQueryTimestamp using new BigQueryTimestamp(Date.now() / 1000) now produces an entirely different date in 1970. The correct date is only obtained when using new BigQueryTimestamp(Date.now() * 1000).
Impact:
This is a breaking change as it affects existing code that relies on the previous timestamp representation. Applications using the library may experience incorrect date values, leading to potential data inconsistencies. In our projects our timestamps are now being represented incorrectly, and because this wasn't marked we need to make some hot fixes.
Proposed Solution:
Considering the breaking nature of this change and following semantic versioning, I think this should've been marked as a Major update to communicate the breaking nature of the timestamp representation switch. Additionally, providing clear documentation and migration steps for users upgrading to version 7.5.0 or later would help minimize the impact on existing projects.
Additional Information:
Node.js version: 20
Operating System: MacOs
Issue Summary:
The latest version (7.5.0) of the Node.js Google BigQuery Client Library has introduced a breaking change in the timestamp representation. The library has switched from the previous representation, where timestamps could be created as numbers using
new BigQueryTimestamp(Date.now() / 1000), to a new representation using int64 microseconds. This change results in incorrect dates when creating BigQueryTimestamps using the previous method, and now requires multiplying the timestamp by 1000 to obtain the correct date.Steps to Reproduce:
Install or update the library to version 7.4.0.
Attempt to create a
BigQueryTimestampusing the old method:new BigQueryTimestamp(Date.now() / 1000).Then update to 7.5.0
Attempt to create a
BigQueryTimestampusing the old method:new BigQueryTimestamp(Date.now() / 1000).Expected Behavior:
The expected behavior is that creating a
BigQueryTimestampusingnew BigQueryTimestamp(Date.now() / 1000)should result in the correct date representation.Actual Behavior:
The actual behavior is that the timestamp representation has changed, and creating a BigQueryTimestamp using
new BigQueryTimestamp(Date.now() / 1000)now produces an entirely different date in 1970. The correct date is only obtained when usingnew BigQueryTimestamp(Date.now() * 1000).Impact:
This is a breaking change as it affects existing code that relies on the previous timestamp representation. Applications using the library may experience incorrect date values, leading to potential data inconsistencies. In our projects our timestamps are now being represented incorrectly, and because this wasn't marked we need to make some hot fixes.
Proposed Solution:
Considering the breaking nature of this change and following semantic versioning, I think this should've been marked as a Major update to communicate the breaking nature of the timestamp representation switch. Additionally, providing clear documentation and migration steps for users upgrading to version 7.5.0 or later would help minimize the impact on existing projects.
Additional Information:
Node.js version: 20
Operating System: MacOs