{"slug":"date-math-datemath-workers-dev-v1-date-range-87e868","title":"Date Math","host":"date-math.datemath.workers.dev","method":"POST","resource":"https://date-math.datemath.workers.dev/v1/date_range","category":"other","description":"Date Math: Turn a reporting period into exact start and end dates and times in a time zone: \"last month\", \"this quarter\", \"YTD\", \"MTD\", \"last 7 days\", \"next 2 weeks\", \"2026-Q3\", \"2026-W14\". Optional comparison period (previous period, or same period last year), fiscal years starting in any month, an","price_listed":0.001,"price_asked":0.001,"state":"answering","state_label":"Answering","checks_7d":7,"answered_7d":7,"latency_ms_median":30,"reported_calls_30d":1,"reported_payers_30d":1,"networks":["eip155:8453"],"badge":"unverified","paid_checks_7d":0,"paid_ok_7d":0,"example_input":{"body":{"as_of":"2026-11-10","compare":"previous_year","period":"last_month","timezone":"America/New_York"},"bodyType":"json","method":"POST","type":"http"},"output_schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","properties":{"input":{"additionalProperties":false,"properties":{"body":{"properties":{"as_of":{"description":"Reference date for relative periods: YYYY-MM-DD, or a datetime (its local date is used). Default: today in timezone","type":"string"},"compare":{"description":"Also return a comparison range. previous_period: the same length immediately before (to-date periods: the same number of days into the previous unit). previous_year: the same dates a year earlier (weeks: 52 weeks earlier, same weekdays)","enum":["previous_period","previous_year"],"type":"string"},"fiscal_year_start":{"default":1,"description":"Month the fiscal year starts (1 = January). Quarters, halves and years follow it; fiscal years are named by the calendar year they end in (start 7: FY2027 = July 2026 – June 2027)","maximum":12,"minimum":1,"type":"integer"},"include_today":{"description":"End the range with today (inclusive). Default true for *_to_date periods, false for last_N_* periods (complete days only)","type":"boolean"},"period":{"description":"Relative: today, yesterday, tomorrow, this_/last_/next_ + week|month|quarter|half|year, week_to_date|month_to_date|quarter_to_date|year_to_date (or wtd, mtd, qtd, ytd), last_N_days|weeks|months|quarters|years, next_N_days|weeks|months|... Spaces work too (\"last 7 days\"). last_N_days = N complete days before today; last_N_months = N complete calendar months before this one. Explicit: 2026, 2026-H1, 2026-Q3 or \"Q3 2026\", 2026-03, 2026-W14 (ISO week), 2026-03-15","example":"last_month","type":"string"},"timezone":{"description":"IANA time zone, e.g. America/New_York (default UTC)","type":"string"},"week_start":{"default":"monday","description":"First day of the week. monday = ISO weeks (labels like 2026-W46)","enum":["monday","sunday","saturday"],"type":"string"}},"required":["period"],"type":"object"},"bodyType":{"enum":["json","form-data","text"],"type":"string"},"method":{"enum":["POST"],"type":"string"},"type":{"const":"http","type":"string"}},"required":["type","method","bodyType","body"],"type":"object"},"output":{"properties":{"example":{"properties":{"as_of":{"description":"The local date that relative periods were resolved against","type":"string"},"comparison":{"properties":{"days":{"type":"integer"},"end_date":{"description":"Last day, inclusive (YYYY-MM-DD)","type":"string"},"end_exclusive":{"description":"Local end, exclusive: the midnight after end_date. Filter with >= start and < end_exclusive","type":"string"},"end_exclusive_utc":{"type":"string"},"label":{"type":"string"},"method":{"type":"string"},"start":{"description":"Local start, ISO 8601 with offset (local midnight)","type":"string"},"start_date":{"description":"First day (YYYY-MM-DD)","type":"string"},"start_utc":{"type":"string"},"type":{"type":"string"}},"required":["type","method","label","start_date","end_date","days","start","end_exclusive","start_utc","end_exclusive_utc"],"type":"object"},"days":{"type":"integer"},"end_date":{"description":"Last day, inclusive (YYYY-MM-DD)","type":"string"},"end_exclusive":{"description":"Local end, exclusive: the midnight after end_date. Filter with >= start and < end_exclusive","type":"string"},"end_exclusive_utc":{"type":"string"},"fiscal_year_start":{"description":"Month name, when not January","type":"string"},"label":{"description":"e.g. \"October 2026\", \"Q3 2026\", \"2026-W46\", \"FY2027\", or \"start to end\"","type":"string"},"period":{"type":"string"},"start":{"description":"Local start, ISO 8601 with offset (local midnight)","type":"string"},"start_date":{"description":"First day (YYYY-MM-DD)","type":"string"},"start_utc":{"type":"string"},"timezone":{"type":"string"},"week_start":{"type":"string"}},"required":["period","timezone","as_of","label","start_date","end_date","days","start","end_exclusive","start_utc","end_exclusive_utc"],"type":"object"},"type":{"type":"string"}},"required":["type"],"type":"object"}},"required":["input"],"type":"object"},"history":[{"day":"2026-11-27","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.001,"price_match":true,"latency_ms":29,"error":null},{"day":"2026-11-26","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.001,"price_match":true,"latency_ms":36,"error":null},{"day":"2026-11-25","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.001,"price_match":true,"latency_ms":21,"error":null},{"day":"2026-11-24","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.001,"price_match":true,"latency_ms":30,"error":null},{"day":"2026-11-23","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.001,"price_match":true,"latency_ms":1575,"error":null},{"day":"2026-11-22","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.001,"price_match":true,"latency_ms":32,"error":null},{"day":"2026-11-21","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.001,"price_match":true,"latency_ms":28,"error":null},{"day":"2026-11-20","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.001,"price_match":true,"latency_ms":26,"error":null},{"day":"2026-11-19","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.001,"price_match":true,"latency_ms":30,"error":null},{"day":"2026-11-18","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.001,"price_match":true,"latency_ms":1165,"error":null},{"day":"2026-11-17","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.001,"price_match":true,"latency_ms":1232,"error":null},{"day":"2026-11-16","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.001,"price_match":true,"latency_ms":29,"error":null},{"day":"2026-11-15","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.001,"price_match":true,"latency_ms":31,"error":null},{"day":"2026-11-14","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.001,"price_match":true,"latency_ms":32,"error":null},{"day":"2026-11-13","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.001,"price_match":true,"latency_ms":31,"error":null},{"day":"2026-11-12","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.001,"price_match":true,"latency_ms":1241,"error":null},{"day":"2026-11-11","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.001,"price_match":true,"latency_ms":1249,"error":null},{"day":"2026-11-10","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.001,"price_match":true,"latency_ms":26,"error":null}],"description_full":"Date Math: Turn a reporting period into exact start and end dates and times in a time zone: \"last month\", \"this quarter\", \"YTD\", \"MTD\", \"last 7 days\", \"next 2 weeks\", \"2026-Q3\", \"2026-W14\". Optional comparison period (previous period, or same period last year), fiscal years starting in any month, and Monday, Sunday or Saturday week starts. Use for analytics queries, SQL date filters, reports and dashboards.","last_updated":"2026-11-10T13:41:46.975Z","schemes":["exact"]}