> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cometly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# resolve_date_range

> Turn a natural-language or preset date phrase into concrete start/end UTC bounds in the space's timezone.

Maps "last week" / "this month" / "yesterday" / "Q1 2026" to deterministic `{start, end, timezone, days_inclusive}` bounds based on the space's configured timezone. Prevents off-by-one errors at week / month / DST boundaries that come from the model doing the math itself.

## When to use

* Any time the user says a relative date phrase and you want a reproducible start/end you can pass into `query_ad_metrics` or `list_events`.
* Cross-platform comparisons that need the same window definition across multiple tool calls.

## Parameters

| Parameter  | Type   | Required    | Description                                                                                           |
| ---------- | ------ | ----------- | ----------------------------------------------------------------------------------------------------- |
| `preset`   | string | Conditional | Exact `DateRange` preset (`last_7_days`, `this_week`, `last_month`, etc.).                            |
| `relative` | string | Conditional | Freeform phrase like `"last week"`, `"yesterday"`, `"this month"`. The server matches it to a preset. |
| `format`   | string | No          | `json` (default), `csv`, or `yaml`.                                                                   |

Provide at least one of `preset` or `relative`. `preset` wins when both are present.

## Output

```json theme={null}
{
  "preset":         "last_7_days",
  "start":          "2026-05-08T00:00:00-04:00",
  "end":            "2026-05-14T23:59:59-04:00",
  "timezone":       "America/New_York",
  "days_inclusive": 7,
  "dst_caveat":     "This window crosses a DST transition in America/New_York. The window length differs from a flat 24h * N days by 1 hour, which may slightly skew period-over-period comparisons."
}
```

The `dst_caveat` field is only included when the window crosses a DST transition in the space's timezone.

## Supported relative phrases

`today`, `yesterday`, `this week`, `last week`, `this month`, `last month`, `this quarter`, `last quarter`, `this year`, `last year`, `last 7 days`, `last 14 days`, `last 30 days`, `last 60 days`, `last 90 days`, `last 365 days`, `all time`.

Substring matches work (`"compare last week to the week before"` resolves to `last_week`). Ambiguous phrases return a `[validation_error]` with a hint listing the supported presets.

## Caveats

Attribution windows in `query_ad_metrics` are calendar-day-based (UTC), not 24-hour rolling. Across DST transitions a 7-day window may span 6d 23h or 7d 1h. The `dst_caveat` field flags this — surface it in your reply when explaining period-over-period changes that cross a DST boundary.
