mcollina / msgpack5

A msgpack v5 implementation for node.js, with extension points / msgpack.org[Node]
MIT License
493 stars 76 forks source link

encode date is null fix #85

Closed zheli-1 closed 3 years ago

zheli-1 commented 3 years ago

Referring to the issue I submitted :D 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 :)

mcollina commented 3 years ago

there seems to be linting errors: https://travis-ci.org/github/mcollina/msgpack5/jobs/744518226

zheli-1 commented 3 years ago

It seems to be a problem with my format. I fixed it. sorry for the delayed reply.

mcollina commented 3 years ago

Can you please add a unit test?

zheli-1 commented 3 years ago

Hi, I have added a unit test for that.