# getDurationSign

Industry: Core

## Signature

```ts
getDurationSign(value: string): number | null
```

Report whether an ISO 8601 duration is negative, zero-length, or positive.

- Uses Temporal.Duration.from and reads .sign: -1, 0, or 1.
- Zero is its own result, not folded into the positive case — "PT0S" is 0, and so is "-PT0S", since a negated zero is still zero.
- Needs no `relativeTo`: a duration's sign is carried on its components, not derived from how long they measure, so calendar-unit durations answer fine.
- Returns null when `value` is not a valid ISO 8601 duration string — distinct from the 0 a valid zero-length duration returns.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `string` | ISO 8601 duration string |

## Returns

-1 for a negative duration, 0 for zero-length, 1 for positive, or null on invalid input

## Examples

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

getDurationSign("P1DT2H") // 1
```

## Source

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