encoder.js encodeDate func throw exceptions when dt is null
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 499
- Forks
- 77
- PR merge metrics
- No merged PRs in 30d
Description
Hi, there.
I am running an auto script testing framework and found out it might be a bug in encoder.js:
it's when encoderDate's argument is null, it throws exceptions so could a condition to avoid this.
Can you verify if it's a potential bug? it would be helpful for my experiment:)
function encodeDate (dt) {
var encoded
//filter
if(dt === null){
return;
}
//zl3
var millis = dt * 1
var seconds = Math.floor(millis / 1000)
var nanos = (millis - (seconds * 1000)) * 1E6
if (nanos || seconds > 0xFFFFFFFF) {
After adding the following line, in test scripting timestamps.js passes.
I will send a pull request if necessary :)
Contributor 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.
Research direction
Inspect encoder.js at encodeDate, then run the timestamps.js test mentioned in the report with a null argument. Compare the current exception with the reported behavior and confirm that the test passes without throwing for null input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100