You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library maps `Date` to the MessagePack timestamp extension, but you re-map the [temporal module](https://github.com/tc39/proposal-temporal) to the timestamp ext like this:
158
+
159
+
```typescript
160
+
import { Instant } from"@std-proposal/temporal";
161
+
import { deepStrictEqual } from"assert";
162
+
import {
163
+
encode,
164
+
decode,
165
+
ExtensionCodec,
166
+
EXT_TIMESTAMP,
167
+
encodeTimeSpecToTimestamp,
168
+
decodeTimestampToTimeSpec,
169
+
} from"@msgpack/msgpack";
170
+
171
+
const extensionCodec =newExtensionCodec();
172
+
extensionCodec.register({
173
+
type: EXT_TIMESTAMP, // override the default behavior!
This will be default after the temporal module is implemented in major browsers, which is not a near-future, though.
198
+
155
199
## MessagePack Mapping Table
156
200
157
201
The following table shows how JavaScript values are mapped to [MessagePack formats](https://github.com/msgpack/msgpack/blob/master/spec.md) and vice versa.
0 commit comments