---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../../modules.md) / [operations/metrics](../index.md) / parseMetricsBound

# Function: parseMetricsBound()

> **parseMetricsBound**(`value`, `now`): `Date`

Defined in: [packages/b2c-tooling-sdk/src/operations/metrics/index.ts:208](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/67fb8580ac3c5b372617ee3ec3fc8f2bc9f16174/packages/b2c-tooling-sdk/src/operations/metrics/index.ts#L208)

Parses a single metrics time bound (`from` or `to`) into a Date.

This is the shared bound parser for the CLI `metrics get` command and the MCP
`metrics_get` tool. It resolves a single bound in isolation; deriving the
companion bound and applying the 24-hour default window is the job of
[resolveMetricsWindow](resolveMetricsWindow.md).

## Parameters

### value

[`MetricsBoundInput`](../type-aliases/MetricsBoundInput.md)

The bound: a Date, epoch milliseconds, a relative duration
  (`5m`/`1h`/`2d`, relative to `now`), or an ISO 8601 timestamp

### now

`Date` = `...`

Reference time for relative durations (defaults to the current
  time; injectable for deterministic tests)

## Returns

`Date`

The resolved Date

## Throws

TypeError if a string value is neither a valid relative duration nor
  a parseable ISO 8601 timestamp

## Example

```typescript
const from = parseMetricsBound('2d');            // 2 days ago
const to = parseMetricsBound('2026-01-25T12:00:00Z');
await getSalesMetrics(client, tenantId, {from, to});
```
