We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2eead72 commit 0c293afCopy full SHA for 0c293af
lib/codecs/DateCodec.js
@@ -1,6 +1,10 @@
1
const type = -1
2
3
function encode (dt) {
4
+ if (dt === null) {
5
+ return
6
+ }
7
+
8
var millis = dt * 1
9
var seconds = Math.floor(millis / 1000)
10
var nanos = (millis - seconds * 1000) * 1e6
test/datenull.js
@@ -0,0 +1,13 @@
+'use strict'
+var test = require('tape').test
+var msgpack = require('../')
+test('encode date is null ', function (t) {
+ var encoder = msgpack({
+ disableTimestampEncoding: true
+ })
+ t.equal(encoder.encode(null)[0], 0xc0, 'encode null as null')
11
12
+ t.end()
13
+})
0 commit comments