(value: Date)
| 1364 | } |
| 1365 | |
| 1366 | function serializeDate(value: Date): string { |
| 1367 | const timestamp = Math.floor(value.getTime() / 1000); |
| 1368 | if (!Number.isFinite(timestamp)) { |
| 1369 | throw new TypeError("Invalid date"); |
| 1370 | } |
| 1371 | if (timestamp < -MAX_INTEGER || timestamp > MAX_INTEGER) { |
| 1372 | throw new TypeError("Date out of range"); |
| 1373 | } |
| 1374 | return `@${timestamp}`; |
| 1375 | } |
| 1376 | |
| 1377 | function serializeDisplayString(value: string): string { |
| 1378 | const bytes = UTF8_ENCODER.encode(value); |
no test coverage detected