diff --git a/blog/2022-01-24-workflows-part-I.md b/blog/2022-01-24-workflows-part-I.md index 908cb4863b..49c0db0f89 100644 --- a/blog/2022-01-24-workflows-part-I.md +++ b/blog/2022-01-24-workflows-part-I.md @@ -97,7 +97,7 @@ function SendReminderEmail(event, context) : Message { return { message: { user: event.user, iter: event.iter + 1}, - after: "1month" + after: "30 days" } } @@ -132,7 +132,7 @@ async function SendReminderEmail(user: string) { // Thanks to Temporal's retry policy, we already // tried twice, better luck next month 🍀 } - await sleep("1 month"); + await sleep("30 days"); } } ``` diff --git a/docs/typescript/workflows.md b/docs/typescript/workflows.md index 8ece65783a..1d85032174 100644 --- a/docs/typescript/workflows.md +++ b/docs/typescript/workflows.md @@ -518,6 +518,10 @@ await sleep(30 * 24 * 60 * 60 * 1000); // numerical API await sleep('30 days').catch(() => { // clean up code if workflow is canceled during sleep }); + +// NOT VALID +await sleep('1 month'); // ms package doesnt support "months" https://github.com/vercel/ms/issues/57 +// use date-fns and sleepUntil instead, see below ``` With this primitive, you can build other abstractions. For example, a `sleepUntil` function that converts absolute time to relative time with `date-fns`: