Closed Veeramani41 closed 1 year ago
pass dateType = 'string'
into the encoder?
is there anyway to stop tagged object decoding and I need to get actual tagged object instead of decoded value. I need to persist all the tags in the data.
Yep. Pass tags = {}
in the decoder options. If you want to decode some tags and not others, you can make a copy of cbor.Tagged.TAGS
, modify it however you like, and pass that in for the tags
option.
I tried tags: {} in the decoder options. it is not working, still decodes the tagged object.
It's going to be {tags: {1: null}}
, but there's a bug I need to fix before that works like the docs say it does.
From the test I just added in #31
const buf = Buffer.from('c100', 'hex');
t.deepEqual(cbor.decode(buf), new Date(0));
t.deepEqual(cbor.decode(buf, {tags: {1: null}}), new cbor.Tagged(1, 0));
9.0.1 release forthcoming.
I opened this back up to make sure that 9.0.1 fixes your issue. Will close when you confirm.
now the issue has been fixed
cbor tagged object not same after decoding and again encoding.
steps: creating cbor with 0 tag like cbor = 0("2023-07-21T07:10:09Z") when decoding the above cbor it is coming with datetime value with localtime zone.
then again if try to encode the cbor it is tagged as 1(1689923409)
it is creating problem while persisting the data and again try to reuse the same data.