Workflow.currentTimeMillis() typescript SDK

Hello
I’m using continueAsNew mechanism for running my workflow over and over, with sleep for 1 day.
In my workflow, I’m waiting for an external signal sent outside the workflow.
I want to rerun the workflow after 1 day, including the time waiting for the signal.
So I was thinking about using Date().getTime() at the beginning of the workflow, and just before sleeping, to calculate the amount of time it needs to sleep, but it violates the determinism concept.
I was looking for alternatives and encountered Java’s SDK’s Workflow.currentTimeMillis() workflow-determinism, but it doesn’t appear to be found in typescript’s SDK

What could solve my problem?
Thanks

You can use Date.getTime() in TypeScript.
TypeScript workflows run in a sandbox where all of the non-deterministic APIs are replaced with safe alternatives.

1 Like