# addDuration

Industry: Core

## Signature

```ts
addDuration(a: string, b: string): string
```

Combine two ISO 8601 duration strings by addition.

- Uses Temporal.Duration.from and .add to combine, then .toString() to re-emit.
- Temporal.Duration.prototype.add has no `relativeTo` option, so combining any pair where either operand has a nonzero years/months/weeks component throws and results in "" — calendar-unit duration arithmetic needs a reference point that this function does not accept.
- Returns "" if either operand is not a valid ISO 8601 duration string.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `a` | `string` | ISO 8601 duration string |
| `b` | `string` | ISO 8601 duration string |

## Returns

ISO 8601 duration string representing a + b, or "" on invalid input

## Examples

```ts
import { addDuration } from "@northguild/gmt/duration/calculate";

addDuration("P1D", "PT2H") // "P1DT2H"
```

## Source

[duration/calculate/addDuration.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/duration/calculate/addDuration.ts)
