mcollina / msgpack5

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

v4.4: DateCode.js - Could not parse Javascript Date #89

Closed StefanKoenigMUC closed 3 years ago

StefanKoenigMUC commented 3 years ago
TypeError: Buffer.allocUnsafe is not a function
    at Object.encode (DateCodec.js:52)
    at encodeExt (encoder.js:136)
    at encode (encoder.js:30)
    at encoder.js:77
    at Array.forEach (<anonymous>)
    at encodeObject (encoder.js:76)
    at encode (encoder.js:30)
    at Array.map (<anonymous>)
    at encode (encoder.js:29)
    at Array.map (<anonymous>)

when a Date is passed console:

dt
Fri Dec 25 2020 09:37:41 GMT+0100 (Central European Standard Time)

millis: 1608885461471 seconds: 1608885461 nanos: 471000000

else if (nanos || seconds > 0xffffffff) is evaluated to true, afterwards


TypeError: Buffer.allocUnsafe is not a function
    at Object.encode (DateCodec.js:52)
    at encodeExt (encoder.js:136)
    at encode (encoder.js:30)
    at encoder.js:77
    at Array.forEach (<anonymous>)
    at encodeObject (encoder.js:76)
    at encode (encoder.js:30)
    at Array.map (<anonymous>)
    at encode (encoder.js:29)
    at Array.map (<anonymous>)

is thrown.

with v4.2.1 its working fine.

mcollina commented 3 years ago

Sorry, I've made a mess with the releases and shipped a semver-major change in the latest release. I've released v4.5.0 as it was v4.2.1. All the new improvements are in v5.0.0.