# Locale and Formatting Tools – Relative Time

> Locale and Formatting Tools – Relative Time is a paid API for AI agents from locale-tools.x402tookit.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-11-02).

Returns a localized relative-time string (e.g. '3 days ago' or 'tomorrow') for a signed numeric value and time unit in any BCP47 locale.

## Facts

- Endpoint: GET https://locale-tools.x402tookit.com/relative-time?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-02
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/locale-and-formatting-tools-relative-time-0aec5fa7
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_-0RQ5UW2U1Gn2AI0VdS8O

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability locale-and-formatting-tools-relative-time-0aec5fa7
```

Example prompt: What's the localized relative-time string for -3 days (3 days ago) in French using the long style and auto numeric mode?

## When to prefer this

Choose this endpoint when you need standards-compliant, ICU/CLDR-backed relative-time formatting across diverse locales — especially for multilingual apps, internationalised UIs, or any scenario where locale-sensitive output (auto 'yesterday' vs '1 day ago', RTL languages, narrow vs long styles) matters and rolling your own Intl.RelativeTimeFormat is impractical.

## Known failure modes

- Missing required 'value' or 'unit' parameters returns a 400-level error
- Invalid or unrecognized BCP47 locale tag may fall back to a default locale with a degraded flag set
- Unsupported unit strings (not one of second/minute/hour/day/week/month/quarter/year) cause validation errors
- Value exceeding absolute magnitude of 1e9 is rejected
- Payment not included or insufficient USDC triggers a 402 Payment Required response

## How this service works

Relative time text such as '3 days ago' or 'tomorrow' for a signed value and unit in any locale.

## Output

Returns a JSON object containing the formatted relative-time string (e.g. 'hace 3 días'), the resolved locale, direction (past/future), decomposed parts with types and values, ICU/CLDR/Unicode version info, and optional degradation or disclaimer flags.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "value",
      "unit"
     ],
     "properties": {
      "unit": {
       "type": "string",
       "description": "second, minute, hour, day, week, month, quarter or year"
      },
      "style": {
       "type": "string",
       "description": "long (default), short or narrow"
      },
      "value": {
       "type": "number",
       "description": "Signed amount: negative is the past, positive the future; absolute value up to 1e9"
      },
      "locale": {
       "type": "string",
       "description": "BCP47 tag such as en, es, de, ja (default en-US, up to 60 characters)"
      },
      "numeric": {
       "type": "string",
       "description": "always (default: '1 day ago') or auto ('yesterday')"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "parts": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "object",
        "properties": {
         "type": {
          "type": [
           "null",
           "string"
          ]
         },
         "unit": {
          "type": [
           "null",
           "string"
          ]
         },
         "value": {
          "type": [
           "null",
           "string"
          ]
         }
        }
       }
      },
      "locale": {
       "type": [
        "null",
        "string"
       ]
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "reasons": {
       "type": [
        "array",
        "null"
       ]
      },
      "summary": {
       "type": [
        "null",
        "string"
       ]
      },
      "verdict": {
       "type": [
        "null",
        "string"
       ]
      },
      "degraded": {
       "type": [
        "boolean",
        "null"
       ]
      },
      
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/locale-and-formatting-tools-relative-time-0aec5fa7/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from locale-tools.x402tookit.com](https://www.zero.xyz/host/locale-tools.x402tookit.com/llms.txt)
