BUG: Timestamp.toObject() returning zeroed value
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- backend
Research direction
Start at Timestamp.toObject() and compare its result with getSeconds() and getNanos() when the value is created through fromDate(), using the dateToTs() example from the report. Reproduce the zeroed fields on version 3.21.4; done when toObject() returns the populated seconds and milliseconds values.
Written by the indexing model from the issue text.
Description
In the latest version, 3.21.4, the Timestamp.toObject() function isn't working correctly.
Previously it would return the timestamp as an object with keys for seconds and milliseconds. However now it is returning zero values for both.
This is a function where I noticed the issue, I've added some logging which pointed out toObject() as being the problem.
function dateToTs(date: Date): Timestamp {
const ts = new Timestamp();
ts.fromDate(date);
console.log(
"date:",
date,
"timestamp:",
ts.getSeconds(),
ts.getNanos(),
ts.toObject(),
);
return ts;
}
See the screenshot below for the resulting console log, where you can see the seconds and milliseconds are set, but the toObject return is zeroed
- Dominant language
- JavaScript
- Stars
- 471
- Forks
- 92
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from protocolbuffers/protobuf-javascript
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
protocolbuffers/protobuf-javascript#248 · 1 comment · 13 reactions ·
-
enhancement port-fix triaged
Difficulty 4/5 3-5 days Newbie friendliness 35/100
protocolbuffers/protobuf-javascript#185 · 1 comment ·
-
enhancement port-fix triaged
Difficulty 4/5 3-5 days Newbie friendliness 35/100
protocolbuffers/protobuf-javascript#182 · 3 comments · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
All issues in protocolbuffers/protobuf-javascript
Similar issues
-
Radix number block generates NaN after switching a negative or decimal number to binary, octal or hexPossibly taken @matthewalberto claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
mit-cml/appinventor-sources#4246 · 1 comment ·
Maintainers usually reply within 1 day
-
marketing
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
accessibility good first issue languages
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 2 days
-
bug help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100