-
Notifications
You must be signed in to change notification settings - Fork 11.4k
Closed
Labels
content:editRequest for content editsRequest for content editsdocumentationDocumentation editsDocumentation editsproduct:durable-objectsDurable Objects: https://developers.cloudflare.com/workers/learning/using-durable-objects/Durable Objects: https://developers.cloudflare.com/workers/learning/using-durable-objects/
Description
Existing documentation URL(s)
What changes are you suggesting?
The "restore 2 days ago" doesn't seem right in Typescript.
let now = new Date();
// restore to 2 days ago
let bookmark = ctx.storage.getBookmarkForTime(now - 2); // <-- 2ms
ctx.storage.onNextSessionRestoreBookmark(bookmark);
I'd use let bookmark = ctx.storage.getBookmarkForTime( new Date(now - (2 * 24 * 60 * 60 * 1000)) ), with or without the new Date. The current code substracts mere 2 milliseconds and also converts bookmark to be a number (which may be intended, not sure).
This is of course minor. Most people will realize to use the right syntax - I'm very impressed with the quality of Cloudflare's documentation.
Additional information
No response
Metadata
Metadata
Labels
content:editRequest for content editsRequest for content editsdocumentationDocumentation editsDocumentation editsproduct:durable-objectsDurable Objects: https://developers.cloudflare.com/workers/learning/using-durable-objects/Durable Objects: https://developers.cloudflare.com/workers/learning/using-durable-objects/