# Workflow.sleepUntil()
[EN] Source: https://mastra.ai/reference/workflows/workflow-methods/sleepUntil

The `.sleepUntil()` method pauses execution until a specified date.

## Usage example

```typescript copy
workflow.sleepUntil(new Date(Date.now() + 5000));
```

## Parameters

<PropertiesTable
  content={[
    {
      name: "dateOrCallback",
      type: "Date | ((params: ExecuteFunctionParams) => Promise<Date>)",
      description:
        "Either a Date object or a callback function that returns a Date. The callback receives execution context and can compute the target time dynamically based on input data.",
      isOptional: false,
    },
  ]}
/>

## Returns

<PropertiesTable
  content={[
    {
      name: "workflow",
      type: "Workflow",
      description: "The workflow instance for method chaining",
    },
  ]}
/>

## Extended usage example

```typescript showLineNumbers copy
import { createWorkflow, createStep } from "@mastra/core/workflows";

const step1 = createStep({...});
const step2 = createStep({...});

export const testWorkflow = createWorkflow({...})
  .then(step1)
  .sleepUntil(async ({ inputData }) => {
    const { delayInMs } = inputData;
    return new Date(Date.now() + delayInMs);
  })
  .then(step2)
  .commit();
```

## Related

- [Suspend & Resume](/docs/workflows/suspend-and-resume#sleep--events)


---
title: "Reference: Workflow.then() | Workflows"
description: Documentation for the `Workflow.then()` method in workflows, which creates sequential dependencies between steps.
---