cloudflare / cloudflare/workerd

R2 Bindings do not allow dates past 2189

Open
#1,687 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
8.7k
Forks
739
Avg merge
2d 20h
Merged PRs (30d)
174

Description

Presumably due to `toKjDate`, the R2 bindings are unable to use dates past `Thu, 31 Dec 2189 23:59:59 GMT` (aka `new Date("2189-12-31T23:59:59.999Z")`).

https://github.com/cloudflare/workerd/blob/4d32cdc6252fc4d93147638243f476d810393611/src/workerd/jsg/value.h#L1061-L1075

This isn't ideal, as some people (like me 😅 ), use `Fri, 31 Dec 9999 23:59:59 GMT` as their default "never expire" date for S3 bucket objects.

If R2 only uses milliseconds internally, shouldn't the Workers R2 bindings allow up to year 9999? (Based on the `R2Object` responses I see from [`.put`](https://developers.cloudflare.com/r2/api/workers/workers-api-reference/#bucket-method-definitions), it looks like R2 only uses milliseconds, not nanoseconds. I could be wrong though.)

```json
{
"customMetadata": {},
"httpMetadata": {
"contentType": "application/pdf",
"contentDisposition": "inline; filename=\"f9ea747b68e91d1490180937d5ac2255.pdf\"",
"cacheControl": "public, immutable, no-transform, max-age=31536000, s-maxage=31536000",
"cacheExpiry": "2189-12-31T23:59:59.999Z"
},
"uploaded": "2024-02-07T19:40:24.552Z",
"checksums": {
"md5": "f9ea747b68e91d1490180937d5ac2255"
},
"httpEtag": "\"f9ea747b68e91d1490180937d5ac2255\"",
"etag": "f9ea747b68e91d1490180937d5ac2255",
"size": 3688121,
"version": "7e727aea0ee83562cb20d56589912332",
"key": "27f01495cb0ea9d387a37001a59def73ae0750575681cbbb6afbf590225b64c2"
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.