Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoder.js encodeDate func throw exceptions when dt is null #84

Open
zheli-1 opened this issue Nov 18, 2020 · 3 comments
Open

encoder.js encodeDate func throw exceptions when dt is null #84

zheli-1 opened this issue Nov 18, 2020 · 3 comments

Comments

@zheli-1
Copy link
Contributor

zheli-1 commented Nov 18, 2020

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 :)

@zheli-1
Copy link
Contributor Author

zheli-1 commented Nov 20, 2020

any update?

@mcollina
Copy link
Owner

Would you like to send a Pull Request to address this issue? Remember to add unit tests.

@zheli-1
Copy link
Contributor Author

zheli-1 commented Nov 21, 2020

Hi, thanks for replying. I've sent a pull request already. I'll add unit tests for sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants