# Duration

A time period in ISO 8601 format

Canonical URL: https://docs.paradoc.dev/schemas/primitives/duration/

A Duration is a string primitive that represents a time period expressed as an ISO 8601 duration string.

## Format

A duration is a string following the ISO 8601 duration format: Weeks use `W`, seconds may have a fractional part, and `P` or `PT` alone is invalid.

```
P[n]Y[n]M[n]W[n]DT[n]H[n]M[n(.n)]S
```

| Component | Description                               |
| --------- | ----------------------------------------- |
| `P`       | Duration designator (required prefix)     |
| `[n]Y`    | Number of years                           |
| `[n]M`    | Number of months                          |
| `[n]D`    | Number of days                            |
| `T`       | Time designator (separates date and time) |
| `[n]H`    | Number of hours                           |
| `[n]M`    | Number of minutes                         |
| `[n]S`    | Number of seconds                         |

## Examples



**YAML**

```yaml
# One year duration
duration: P1Y

# Thirty minutes
timeout: PT30M
```

**JSON**

```json
{
  "duration": "P1Y",
  "timeout": "PT30M"
}
```
