Convert timestamp columns into Date objects and vice versa #41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After the previous PR, I got a taste for it and tried my hand at adding proper timestamp support. Currently it's a bit awkward to deal with timestamp columns. Timestamp values get serialized as numbers, but because timestamps are internally stored as 64 bits the value that's handed to you in JS land is garbage.
You have to resort to passing the timestamp value as a buffer through the
timestampAsBlob
function and then running that through something like long to get the actual value back out.This PR allows you to:
timestamp
by passing in aDate
objecttimestamp
columns asDate
objects.This is a breaking API change as timestamp values are no longer coming back as Numbers but proper Date objects. The PR isn't ready to be merged, but I liked to get your thoughts on whether this is a good idea and worth further development. If you're on board I'll refactor some of those timestamp tests and get this ready to be merged into master