@andrew_l/tl-pack 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -190,7 +190,7 @@ export class BinaryReader {
190
190
  */
191
191
  readDate() {
192
192
  const value = this.readDouble();
193
- return new Date(value * 1000);
193
+ return new Date(value);
194
194
  }
195
195
  /**
196
196
  * Reads a object.
@@ -152,7 +152,7 @@ export class BinaryWriter {
152
152
  writeDate(value) {
153
153
  let timestamp = 0;
154
154
  if (value instanceof Date) {
155
- timestamp = Math.floor(value.getTime() / 1000);
155
+ timestamp = value.getTime();
156
156
  }
157
157
  else if (typeof value === 'number') {
158
158
  timestamp = value;
@@ -265,7 +265,12 @@ export class BinaryWriter {
265
265
  const start = this.offset;
266
266
  this.allocate(1);
267
267
  this.offset++;
268
+ let edgeExt;
268
269
  for (const ext of this.extensions.values()) {
270
+ if (ext.token === -1) {
271
+ edgeExt = ext;
272
+ continue;
273
+ }
269
274
  ext.encode.call(this, value);
270
275
  const processed = start < this.offset;
271
276
  if (processed) {
@@ -277,6 +282,10 @@ export class BinaryWriter {
277
282
  }
278
283
  }
279
284
  this.offset = start;
285
+ if (edgeExt) {
286
+ edgeExt.encode.call(this, value);
287
+ return start < this.offset;
288
+ }
280
289
  return false;
281
290
  }
282
291
  writeObject(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andrew_l/tl-pack",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Binary serialization library",
5
5
  "type": "module",
6
6
  "scripts": {