Skip to main content

date-wrangler

Wrangles messy human dates into clean ranges: parses last quarter, since March, 15 Jan 2024.

Whatever someone types — an absolute date, a relative expression, an open-ended range, a fiscal period — it comes back as one type: a half-open DateRange that is safe to hand straight to a query.

Status: stable. The public API follows semantic versioning: a change that breaks existing callers comes only with a new major version. What changed in each release is in the changelog.

Why another date library

Most date libraries answer "what instant is this?". date-wrangler answers "what range is this?" — which is the question you actually have when a person types last quarter, since March, or Q1 FY25 into a search box.

Everything is a range: a single day is a DAY-grain range, a month is a MONTH-grain range, a fiscal quarter is a QUARTER-grain range on the fiscal basis. That one decision is what lets days, weeks, quarters, fiscal years and open-ended intervals share an API instead of each needing their own.

Install

pip install date-wrangler

Python 3.10+. No runtime dependencies, except tzdata on Windows — which ships no system timezone database, so the standard library needs it for the optional tz= argument. pip install "date-wrangler[mcp]" adds the MCP server for AI agents.

The core model

from datetime import date
from date_wrangler import FiscalCalendar, Basis
from date_wrangler.calendars import quarter_range, month_range, current_fiscal_year

cal = FiscalCalendar.india()                  # fiscal year starts in April
fy = current_fiscal_year(date(2025, 9, 4), cal)   # -> 2026

q1 = quarter_range(fy, 1, cal, Basis.FISCAL)
q1.start          # date(2025, 4, 1)
q1.end            # date(2025, 7, 1)   <- exclusive
q1.end_inclusive  # date(2025, 6, 30)  <- for display
q1.grain          # Grain.QUARTER
q1.sql("order_date")
# "order_date >= '2025-04-01' AND order_date < '2025-07-01'"

Ranges are half-open

end is the first day outside the range, never the last day inside it. This is the Duckling convention and it exists to prevent a specific, common data bug:

feb = month_range(2024, 2)
feb.end            # date(2024, 3, 1)
feb.end_inclusive  # date(2024, 2, 29)

WHERE ts BETWEEN '2024-02-01' AND '2024-02-29' silently drops every row after midnight on the 29th when ts is a timestamp. ts < '2024-03-01' does not. Half-open ranges also tile exactly — Q1.end == Q2.start — so they compose without off-by-one errors.

Why < and not the <= everyone writes. SQL reads a bare '2024-02-29' as '2024-02-29 00:00:00' — the first instant of the day, not the day. So on a TIMESTAMP or DATETIME column, <= keeps only rows stamped exactly midnight:

predicate, ts is a TIMESTAMP rows found
ts BETWEEN '2025-04-01' AND '2025-06-30' 1
ts >= '2025-04-01' AND ts <= '2025-06-30' 1
ts >= '2025-04-01' AND ts < '2025-07-01' 4

The two are identical on a DATE column, where every value is midnight. The library can't see which it is, and < is right for both. When you know it's a DATE:

r.sql("order_date", inclusive=True)   # ... AND order_date <= '2025-06-30'

Quoting and literals per engine. The default quotes nothing and writes a bare string, which most engines accept. Two things break that: a column named order, date or with a space in it, and Oracle, which converts a bare '2026-07-01' using the session's NLS_DATE_FORMAT and so raises or reads a different date.

from date_wrangler import SqlDialect

r.sql("m.claim_date", dialect=SqlDialect.oracle())
# m.claim_date >= DATE '2025-04-01' AND m.claim_date < DATE '2025-07-01'
r.sql("order date", dialect=SqlDialect.tsql())
# [order date] >= CAST('2025-04-01' AS DATE) AND [order date] < CAST('2025-07-01' AS DATE)
r.sql("m.date", dialect=SqlDialect.oracle())
# m."DATE" >= DATE '2025-04-01' AND m."DATE" < DATE '2025-07-01'

Identifiers are quoted only where they have to be, and that is a correctness rule, not a style one. Oracle, Snowflake, HANA and DB2 store an unquoted name in upper case, so a column created as claim_date is held as CLAIM_DATE and the quoted "claim_date" is an invalid identifier. Bare claim_date is right on every engine, so a plain name is left alone. When quoting is needed:

  • a reserved word that is otherwise plain was created unquoted, so it is folded to the case the engine stored it in — "DATE" on Oracle, "date" on Postgres;
  • a name with a space or punctuation must have been created quoted, so it keeps exactly the case you gave;
  • a qualified name is quoted part by part — m.claim_date is a table and a column, not one column with a dot in it.

Presets: .plain() (the default), .ansi(), .postgres(), .redshift(), .oracle(), .snowflake(), .hana(), .tsql(), .fabric(), .mysql(), .bigquery(), .databricks(), .sqlite(). They are shorthand for a few independent choices — quote characters, literal style, which case the engine folds unquoted names to, and quoting="needed" or "always" — so an engine with no preset is still expressible.

Engine Name Date
ANSI, Postgres, Redshift "order date", "date" DATE '2025-04-01'
Oracle, Snowflake "order date", "DATE" DATE '2025-04-01'
SAP HANA "order date", "DATE" CAST('2025-04-01' AS DATE)
SQL Server, Fabric (T-SQL) [order date], [date] CAST('2025-04-01' AS DATE)
BigQuery, Databricks, Spark SQL `order date`, `date` DATE '2025-04-01'
MySQL `order date`, `date` '2025-04-01'
SQLite "order date", "date" '2025-04-01'

.fabric() is .tsql(): a Fabric Warehouse and its SQL analytics endpoint speak T-SQL. Spark SQL in a Fabric notebook is .databricks(). HANA's typed literal is documented only without a space, DATE'2025-04-01', so its preset writes the standard CAST.

To keep a preset's date but quote nothing — for a condition whose column is a placeholder filled in later — take quoting off: dataclasses.replace(SqlDialect.redshift(), quote_open="", quote_close="") writes <column> >= DATE '2025-04-01' AND <column> < DATE '2025-07-01'.

Printing never shows the exclusive end. str(r) reports the last day inside the range, because [2025-09-04, 2025-09-05) reads as two days however correct the bracket is:

print(parse_one("today").range)          # 2025-09-04 (1 day)
print(parse_one("last quarter").range)   # 2025-04-01 .. 2025-06-30 (91 days)
print(parse_one("since March").range)    # 2025-03-01 onwards

repr(r) still shows the stored fields, exclusive end and all.

Anchored or rolling

last month has two defensible readings, and which one you get should not be an accident. Asked on 4 September:

parse("last month")                                       # 2025-08-01 .. 2025-09-01
parse("last month", config=WranglerConfig(anchor=Anchor.ROLLING))
                                                          # 2025-08-04 .. 2025-09-04

Anchored (the default) snaps to whole calendar units. Rolling measures back from today. Anchored is the default because only whole units are comparable — rolling months are 28 to 31 days long, so month-on-month stops being like-for-like — and because a part-finished current period should not be mixed in with completed ones.

The wording wins over the setting where it is explicit: rolling 3 months always rolls, and TTM / trailing 12 months never does, because in reporting that means the last twelve completed months. Day-grain phrases like last 30 days are the same either way — a day is its own unit, so there is nothing to snap to.

r.anchor is on the range, so callers can tell which they got.

Which day a week starts on

Monday by default, which is ISO and most of the world. A US workspace wants Sunday, and the difference is a whole day of data at each end of every weekly report:

parse("last week")                                            # Mon 5 – Sun 11 Oct
parse("last week", config=WranglerConfig(week_starts_on=6))   # Sun 4 – Sat 10 Oct

It applies to this/last/next week, multi-week spans, and this Tuesday — which means "the one in the current week". It deliberately does not apply to this weekend: a weekend is the Saturday–Sunday pair, and on a Sunday-start calendar that pair straddles the week boundary, so following the setting would split it.

Nor to numbered weeks. week 42, 2026-W42, CW42 and KW 42 are ISO 8601 weeks, which are Monday to Sunday by definition — renumbering them from Sunday would make one label mean different days under different settings. The ISO year is not the calendar year either: 2026-W01 begins on 29 December 2025, and some years have a week 53 and others do not. Asking for one that does not exist is refused with a diagnostic, not rounded into the next year. A bare W42 is treated like a bare month name and needs a cue (in W42), because on its own it is just as likely a part number.

A week numbered in something is that thing's week, not an ISO week: fiscal week 3, week 3 of FY25 and week 3 of January count seven days at a time from the period's first day, as the 3rd week of FY25 and the 3rd week of January do, and do not follow this setting either. With nothing fiscal about it, week 3 of 2025 stays ISO week 3.

Business days

parse("5 business days ago")                 # one day, weekends skipped
parse("last business day of the month")      # the close date, not the 31st if that's a Sunday
parse("first working day of next month")
parse("last 10 business days")               # a window holding exactly ten working days

Weekend and holidays are configuration, never guessed:

WranglerConfig(
    weekend=(4, 5),                                   # Friday–Saturday
    holidays=frozenset({date(2026, 12, 25), ...}),    # yours, from wherever you keep them
)

Which days are holidays depends on a country, a region, an industry and sometimes one company's handbook. A built-in list would be wrong somewhere and confident everywhere, so the default counts weekends only and you supply the rest.

A business-day window is contiguous and keeps any weekend inside it, because a date filter has to be one range. Both ends land on a working day, though — asked on a Monday, last business day is Friday, not Friday to Sunday. r.business_days(weekend=..., holidays=...) says how many of a range's days are working ones; it takes the calendar as arguments for the same reason split() does, since a range does not carry configuration.

Open-ended ranges

Either bound may be None, which is what makes since March and before 2024 expressible at all:

r.start, r.end     # date(2024, 3, 1), None
r.is_bounded       # False
r.sql("d")         # "d >= '2024-03-01'"

end=None means unbounded — never a silent "up to today". Deciding between those is the caller's business, so you opt in explicitly:

r.clamp(hi=date.today() + timedelta(days=1))

Which side of the boundary day falls on follows the words, because a boundary day is exactly the data that goes missing without anyone noticing:

phrase range boundary day
after 1 April, before 31 March from 2 April / up to 30 March excluded
on or after 1 April, not before 1 April, no earlier than 1 April from 1 April included
on or before 31 March, not after 31 March, no later than 31 March up to 31 March included
by 31 March, through 31 March, until 31 March, up to and including 31 March up to 31 March included
before the end of March, by end of year up to the period's last day included
from 1 April, from today, from Monday from that day on included

from opens a range only before a single day. After a period it usually names a source — the figures from Q1 are Q1's figures, not everything since — so it is left as the period.

Grouping and comparing

Parsing gives you one range. A report needs one row per bucket, and a number to compare it against. Both are date arithmetic that is easy to get quietly wrong by hand, so the range does them:

today = date(2025, 9, 4)
r = parse_one("last 3 months", today=today).range

for bucket in r.split(Grain.MONTH):
    print(bucket, bucket.sql("order_date"))
# 2025-06-01 .. 2025-06-30 (30 days)  order_date >= '2025-06-01' AND order_date < '2025-07-01'
# 2025-07-01 .. 2025-07-31 (31 days)  ...
# 2025-08-01 .. 2025-08-31 (31 days)  ...

q = parse_one("Q1 FY25", today=today).range   # 2024-04-01 .. 2024-06-30
q.previous()                                  # Q4 FY24: 2024-01-01 .. 2024-03-31
q.year_earlier()                              # Q1 FY24: 2023-04-01 .. 2023-06-30

previous() is the period just before, as long. A range of whole units steps back by its own length in its own units and ends where it starts: a quarter gives the quarter before, last 3 months the three before them, last 30 days the thirty before. A period cut short gives the same stretch of the one before — month to date on the 17th gives the 1st to the 17th of last month, and on 30 March all of February. Anything else gives as many days again, just before it.

year_earlier() is the same period a year back. A week on the calendar's grid — last week, W12, week ending 6 March — goes back 52 weeks, so it starts on the same weekday and lands on a week a weekly report already groups by. Everything else takes the same dates, including a week counted from a period's first day: week 3 of FY25 gives week 3 of FY24. The two kinds of week can be the same Monday to Sunday — the 2nd week of January 2024 and the week of 8 January 2024 — so a range says which it is in counted_in_period, which is not part of equality. Both raise ValueError on a range with an open end.

period_of(day, grain, config) is the whole week, month, quarter, half or year that holds a day — by the same rule the parser reads the week of 5 October and the quarter of June, so an axis and a parsed phrase agree on where every period starts. A week starts on week_starts_on; a quarter, half or year is on year_basis unless basis= says otherwise. For a trend axis, take the periods of both ends and split between them:

from date_wrangler import period_of

cfg = WranglerConfig(year_basis="fiscal")             # April years
first = period_of(date(2026, 2, 10), "quarter", cfg)  # 2026-01-01 .. 2026-03-31
last = period_of(date(2026, 11, 18), "quarter", cfg)  # 2026-10-01 .. 2026-12-31
axis = DateRange(first.start, last.end, Grain.QUARTER).split(Grain.QUARTER)
[b.start for b in axis]  # 1 January, 1 April, 1 July, 1 October 2026

shift(n, grain) is the step underneath, for any other comparison. It moves by whole units of the range's own grain, both ends together, so the length survives. That is the part hand-rolled arithmetic loses: - timedelta(days=90) drifts because quarters are 90 to 92 days, - timedelta(days=365) breaks across a leap year, and start.replace(year=...) raises on 29 February. Basis comes along too — a fiscal Q1 starts on a fiscal boundary already, so one step back lands on fiscal Q4 of the year before.

split tiles the range exactly: each bucket's end is the next one's start, no gap and no day counted twice. The grid starts at start rather than at a calendar boundary, so a fiscal year splits into its own fiscal quarters without being told which calendar it is on, and a range that begins mid-unit never widens outwards to cover days you did not ask for. Only the final bucket can be short, and bucket.days says by how much.

Combining ranges

Ranges compose like sets, with an unbounded end treated as an infinity throughout — which is the only reading that lets since March take part at all:

q1 & since_feb          # intersection — the general form of clamp()
q1.overlaps(q3)         # False; half-open means Q1 and Q2 are adjacent, not overlapping
feb in q1               # containment; a bare date still works too
q1 | q2                 # union of two ranges that meet
q1.difference(feb)      # [Jan, Feb) and [Mar, Apr) — a bite out of the middle

Intersecting disjoint ranges gives an empty range, not None, so a chain keeps working; check result.is_empty. Results take the finer grain — an intersection is never longer than the shorter side — and drop mod, which described the range it came from.

difference returns a list, because subtracting from the middle leaves two pieces.

| raises when the two do not meet. A union across a gap is two ranges, not one, and returning the hull silently is exactly how Q1 and Q3 comes to include Q2. Call q1.hull(q3) when the widening is what you actually want.

Configuration

Config is passed per call and never read from a module global, so one process can serve tenants on different fiscal calendars.

from date_wrangler import (
    Anchor, DateOrder, FiscalCalendar, MonthNumber, WranglerConfig, YearLabel,
)

WranglerConfig(
    fiscal=FiscalCalendar.us_federal(),   # October start
    anchor=Anchor.ANCHORED,               # what "last month" means
    date_order=DateOrder.MDY,             # how to read 03/04/2024
    month_number=MonthNumber.YEAR,        # what "jan 24" means
    week_starts_on=6,                     # 0=Monday (default), 6=Sunday for the US
    weekend=(5, 6),                       # non-working days, for "business days"
    holidays=frozenset(),                 # yours to supply; never guessed
    year_basis="fiscal",                  # undeclared years and periods; calendar by default
    two_digit_pivot=68,                   # "99" -> 1999, not 2099
    strictness="balanced",
)

Presets: FiscalCalendar.india(), .uk(), .australia(), .us_federal(), .calendar().

Fiscal years follow the pandas Q-MAR convention by default — labelled by the year they end, so with an April start FY2024 runs Apr 2023 – Mar 2024 and Apr–Jun is Q1. Set label_by=YearLabel.START_YEAR for the US corporate convention.

Which calendar a phrase is read on follows one rule: what it says, otherwise year_basis.

phrase read on
FY2024, FY24 Q3, fiscal year 2024, fiscal Q3, this fiscal year, last FY fiscal — it says so
CY2024, CY24, CY Q3, calendar year 2024, this calendar year calendar — it says so
everything else — 2024, the year 2024, Q4 2024, Q3'24, Q1, H1, last quarter, QTD, this year, YTD, the second half of 2024, the last quarter of 2024 year_basis

There are no per-phrase exceptions, which is the point: earlier versions decided this phrase by phrase, and the phrases disagreed — the second half of 2024 came back on the calendar while the last quarter of 2024 followed the fiscal setting. Now every spelling of a year agrees, and every part of a year lies inside it.

year_basis defaults to calendar, so out of the box Q1 2024 is January to March 2024 and in 2024 is the whole calendar year, which is what most people who write them mean. A finance team that says "Q1" and means its fiscal Q1 sets year_basis="fiscal":

phrase default (calendar) year_basis="fiscal", April start
2024, the year 2024 Jan – Dec 2024 Apr 2023 – Mar 2024
Q4 2024, the last quarter of 2024 Oct – Dec 2024 Jan – Mar 2024
the second half of 2024 Jul – Dec 2024 Oct 2023 – Mar 2024
Q1 Jan – Mar 2026 Apr – Jun 2026
this year Jan – Dec 2026 Apr 2026 – Mar 2027
January, 15 January January 2026 January 2027
FY2024 Apr 2023 – Mar 2024 Apr 2023 – Mar 2024
CY2024 Jan – Dec 2024 Jan – Dec 2024

Only the last two rows hold still — they say which calendar they mean. A value from a form or select works as-is: "calendar" and "fiscal" are accepted in any case, and anything else fails on construction, by name.

A month with no year is in the year in progress on year_basis, as Q4 is: on a fiscal basis January is the January inside this fiscal year, never a year apart from the quarter that holds it. Two things look back instead. since, which points to the past, takes the latest such month that has begun, on either basis: asked in February, since March is last March. from 1 March, after 31 March, on or after, not before, by and until may point ahead — "the new price applies from 1 March" — and keep the year in progress. And a span that ends on a period counted from today — 15 March to last month, March to today — starts before it.

parse("Q1 2024")                           # January to March 2024
parse("FY2024")                            # April 2023 to March 2024 — it says fiscal

cfg = WranglerConfig(year_basis="fiscal")
parse("in 2024", config=cfg)               # April 2023 to March 2024
parse("Q1", config=cfg)                    # April to June
parse("CY2024", config=cfg)                # January to December 2024 — it says calendar

Which one is right depends on who is asking, so in a multi-tenant app set it per tenant rather than relying on the default.

bare_period_basis is now only the default for year_basis, kept under its old name so older configurations mean what they did: one that set bare_period_basis="fiscal" is still fiscal. Its own default used to be fiscal and is now calendar, so a configuration that set neither now reads Q1 as January to March; set year_basis="fiscal" to keep the old answers. of_year_basis remains as an optional override for "a period of a year" — Q1 of 2024, the second half of 2024 — and inherits year_basis unless set; you will rarely want it.

Invalid configuration fails on construction with a message naming the field, not later from inside date() on the first request that mentions a quarter.

jan 24 — day or year?

Genuinely ambiguous, and it depends who is writing. Prose means the 24th; a finance sheet listing jan 24, feb 24, mar 24 means the year. month_number decides:

parse("jan 24")                                    # 24 January 2025   (default)
parse("jan 24", config=WranglerConfig(month_number=MonthNumber.YEAR))
                                                   # January 2024

The setting only decides that ambiguous middle. Everything else settles itself:

written reads as why
march 3 3 March a single digit is never a year
jan 24th 24 January ordinal suffix
jan '24 January 2024 apostrophe
jan 2024 January 2024 four digits
jan 87 January 1987 above 31, so it cannot be a day
january 15, 2024 15 January 2024 the year is already stated
jan-24, jan/24 January 2024 a hyphen or slash joins a month to its year
Jan-Mar 24, Jan to Mar 24 January to March 2024 months with no day of their own: the two digits are the year they are written with

Beside a day it stays a day: Jan 15 - Mar 24 is 15 January to 24 March. And Jan-Mar 31 ends where March does, whichever way it is read, so it is read as the day.

Parsing text

from date_wrangler import parse

for m in parse("revenue for Q1 FY25 vs Q1 FY24", today=date(2025, 9, 4)):
    print(m.text, m.span, m.range.start, m.range.end)
# Q1 FY25 (12, 19) 2024-04-01 2024-07-01
# Q1 FY24 (23, 30) 2023-04-01 2023-07-01

parse() returns DateMatch objects carrying the resolved range, the matched text and its span in the string you passed — so you can highlight or rewrite without searching again.

A comparison stays two matches. Merging compare Q1 2024 to Q1 2025 into one fifteen month span is the kind of error that survives review because the number still looks plausible.

Which dates go together

Each match says which dates were named with it, so a question that compares two periods can be told from one that merely mentions two dates:

[(m.text, m.group, m.joined_by) for m in parse("revenue in Q1 and Q3 2024 vs 2023")]
# [('Q1', 0, None), ('Q3 2024', 0, 'list'), ('2023', 0, 'compare')]

[(m.text, m.group) for m in parse("diagnosed on 1994/2/19, tested on 1993/11/12")]
# [('1994/2/19', 0), ('1993/11/12', 1)]          — two groups: nothing joins them

group numbers the dates named together from 0, in order; a date on its own has a group to itself. joined_by is how a match is joined to the one before it: "list" (and, &, a comma), "compare" (vs, versus, against, compared to), or "range" for a span that could not be made, which diagnose explains. It is None for the first in a group.

A span is one match, and endpoints holds the two periods it was made from, for questions about a change between them:

m = parse_one("decrease rate from 2012 to 2013")
str(m.range)                   # '2012-01-01 .. 2013-12-31 (731 days)'
[str(e) for e in m.endpoints]  # ['2012-01-01 .. 2012-12-31 (366 days)',
                               #  '2013-01-01 .. 2013-12-31 (365 days)']

endpoints is None for anything that is not a span between two periods: Q1 2024, since 2012, the year to March 2024.

What it understands

Fiscal periods Q1 FY25, Q1FY24, H1 FY25, 1H 2024, FY2024-25, Q1 FY2024-25, FY2024-25 Q3, fiscal 2024, fiscal-year 2024, 2023-24 financial year, fy-24, F.Y. 2024, FY ending June 30, 2024
Assessment year A.Y. 2025-26, AY 2025-26, assessment year 2025-26, Q1 AY 2025-26 — always the fiscal year before it, whose income it assesses: A.Y. 2025-26 is F.Y. 2024-25
Tax year tax year 2025-26, this tax year, last tax year, tax year start, tax year end 2024, Q1 of the tax year, tax week 3, tax year to date — the fiscal year on your fiscal calendar, read exactly as fiscal year is: tax year 2025-26 is F.Y. 2025-26, whose income AY 2026-27 assesses. A fiscal calendar starts on the first of a month, so the UK's personal tax year, from 6 April, is read from 1 April; one that ends on a day given — the tax year ending 5 April 2024 — ends there. tax before anything but a year changes nothing: tax day, tax YTD
Split years 2024-25, 2012/13 with no FY follow year_basis, as any year does: on a fiscal basis the fiscal year 2024-25 (and Q3 2024-25 its third quarter); on a calendar basis the years 2024 to 2025, of which Q3 2024-25 is not one period, so diagnose says to write FY2024-25. 2011-12 is a fiscal year on a fiscal basis and December 2011 on a calendar one
Quarter spellings Q3'24, Q3-2024, 2024-Q3, 2024Q3, FY24 Q3, 3Q24, 1H24, 1HFY24, fiscal Q3, Q3 FY — and a quarter, half or month beside its year: Q3 in 2024, Q3/FY24, FY 2024 Qtr 3, 2024 - third quarter, June in 2024, Mar/2024, 2024 March, and run together: 2024QTR3, FY2024-25QTR3, Qtr 3-24, 2024March, MarchFY24. A spaced dash after the label is a span, as June - FY25 always was; before it, a heading: FY24 - Q3, 2024 - March
Years and labelled periods 2024, the year 2024, Q1 of 2024, January 2024, CY2024 — see which calendar for how a year is read
Fiscal month index third month of FY24, twelfth month, month 3 of FY24, FY24 month 3, fiscal month 3, months 3-5 of FY24, and as reports head a column: FY24 M3, FY24-M03, FY24 M3-M5, read at confidence 0.8, since M3 may be the money supply. Only straight after the fiscal year and only M1 to M12: M3 FY24, BMW M3 FY24 and FY24 M25 read FY24 alone
Month of a fiscal year June FY25, Jun-FY25, FY25 June, June FY 2024-25, Oct to Mar FY25 — the June inside FY25, so June 2024 with an April year; June 2025 stays June 2025
Relative last 3 months, next 2 quarters, 3 months ago, this week, yesterday — and spelt short: last 3months, 3mos ago, last mth, prev quarter, a couple of weeks ago, yday, tmrw. A single letter for a unit (3m) is not read: it is minutes or millions as often as months
Stated basis this fiscal year, this FY, last 2 fiscal quarters, next calendar year
Weekdays last Monday, next Friday, this Tuesday
To-date YTD, MTD, QTD, WTD, year-to-date, Y-T-D, so far this year; FYTD, fiscal YTD, FY to date (from the fiscal year's start), CYTD; last YTD, LYTD, YTD last year (the same window a year earlier), last MTD, LMTD (the same days of last month), last year's MTD; YTD 2024, 2024-YTD, YTD through March 2024, March 2024 YTD
Period to date this year to date, Q3 to date, October to date, March 2024 to date
Reporting shorthand TTM, LTM, T12M, L3M, trailing 12 months, rolling 3 months
Period-ending quarter ending June 2024, year ended March 2024, six months to June 2024, the 12 months to March 2024, the half year to 30 September 2024, and as reports abbreviate them: QE June 2024, YE March 2024, FYE March 2024, 12M to March 2024, 6M to June 2024. FYE 2024, FYE 24, 2024 FYE, fiscal year end 2024 and fiscal year end of 2024 are the fiscal year that ends in 2024, April 2023 to March 2024 with an April year; FYE FY24 and FY24 FYE are FY24, whatever year names it. A period named by its end can be counted in: week 3 of the half year ending June 2024, month 3 of the fiscal year ending March 2025, the last day of the quarter ended June 2024
Absolute 2024-03-15, 15 January 2024, January 15, 2024, March 15 2024, 2024 March 15, 03/04/2024, 01-04-2018, 13.06.18
A comma or weekday inside the date June, 2013, 12 March, 2014, Q1, 2024, Friday, 15 March 2024 — one date, and a weekday that does not match it is flagged
Months as numbers 2024-03, 2024/03, 03/2024, 03-2024
Abbreviations and run-together forms Sept. 2013, Mar. 15, 2024, FEB.2018, 15MAR2024, 13june2018, 01may 2018, may'18, June' 2018, Mar-15-2024
Ranges Q1 to Q2, Jan–Mar, from April to September 2024, Nov to Feb (wraps), 2024-03-15/2024-03-20, 1-4-2018-31-5-2018, the years 2012 through 2014, and a year written once at the end: Jan-Mar 24, Nov-Feb 24 (November 2023 to February 2024). Two spans side by side each keep their own year: Q1-Q3 2024 vs Q1-Q3 2025, compare Jan-Mar 2024 with Jan-Mar 2025
Up to today 01/06/2018 to till date, from 01/06/2018 till date, April 2015 to till date, 1st march 2018 to as on date, from 2012 to present, 2012-present, 1 June 2018 up till now, June 2018 till present, 1 June 2018 to-date, as on date, as of now. A from or since day with an end written after it ends there, not open-ended
Open-ended since March, from Q1 onwards, up to March 2024, before 2024, after FY24, prior to 2012, pre-2012, pre 2012, post-2012, 2012 and later, in or after 2012, starting 2012, beginning March 2024 (March onwards), not later than March 2024, w.e.f. 1 April 2024, and as a query writes them: >= 2024-03-15
Counted from a date 3 days before 15 March 2024, two weeks after 1 April, a year after March 2024, the day after 15 March, 3 days earlier than 15 March 2024, 1 April 2024 + 2 weeks, 3 business days before 18 March 2024
Two back the month before last, the year before last, the week before last
The nearest month last March, this March, next March
Weekdays of a week Friday last week, last week Friday, last week's Fri, Fri. last week, Monday to Friday last week, Monday next
Decades the 1990s, the 1990's, the '90s, the 90s, the nineties, the early 1990s, mid-1990s, the late 90s
Reporting periods 9M 2024, 9M FY24 (the first nine months), the March quarter 2024 (the quarter ending March), the first 3 quarters of 2024, first fortnight of March
Point-in-time as of 31 March 2024
Relative year Q1 last year, March last year, June previous year, H2 next year — and a fiscal one, the period inside it: Q1 last FY, Q4 of this fiscal year, June of this fiscal year, H2 of the following FY
Part of a period first half of March, early 2024, mid March, end of Q1
Day in a period 1st of next month, 15th of March, the last day of the month, the last day of the fiscal year
Runs of days 1-15 March, March 1-15, 2024, 1st to 15th March, 15-20 Mar-24, 2024 March 15th-20th, between the 15th and the 20th of March 2024, 15-20 June FY25, and across months: 15 March 2024-20 April 2024, 28 Dec - 3 Jan 2024. Days listed, 15, 16 and 20 March 2024, are each a date of their own
Unit of a period the first week of April, first wk of April, the last week of March, the last 3 months of the year, last 3 mths of 2024, the last quarter of 2024, the last month of the fiscal year, the last quarter of this fiscal year, week 3 of January, weeks 3-5 of January, week 10 of Q1 2025, the 20th week of FY25. A week of a period is seven days counted from its first day: the 3rd week of January is the 15th to the 21st, whatever day the week starts on
Deadlines by 31 March, on or before 31 March, no later than Friday, not before 1 April
Nth weekday first Monday of March, last Friday of the month, last Friday of month, 3rd Thursday of November, the 3rd Thurs. of Nov.
Week numbers week 42, 2026-W42, CW42, KW 42, week 42 of 2026, 2026 week 42, W42-2026, week no. 42, weeks 42-43 2026
Fiscal weeks fiscal week 3, week 3 of FY25, FY25 week 3, fiscal weeks 3-5 FY25, week 3 to week 5 of FY25, weeks 3 and 5 of FY25 — counted from the fiscal year's first day, as the 3rd week of FY25 is: 15 to 21 April 2024 with an April year
Business days 5 business days ago, next business day, last business day of the month, last 5 biz days, next workday
Same period back same quarter last year, same month of last year, same quarter LY, this time last year, and on the fiscal calendar: same quarter last FY
Weekend this weekend, next weekend, last weekend
Period edges month end, EOM, E.O.M., end-of-month, EOQ, end of the quarter, end of 1Q 2024, year start, last day of month, last workday of the month, and of the fiscal year: fiscal year end, FY end, FYE, fiscal year start. With its year, a year's start is that year's: year start 2024, fiscal year start 2024, 2024 F.Y. start
Ahead in 3 days, 2 weeks from now, 3 months from today
Fortnights a fortnight ago, last fortnight, next fortnight
Day idioms day before yesterday, day after tomorrow
Written formats 15-Mar-2024, 15 Mar 24, Mar-24, Mar/24, 15.03.2024, 2024/03/15, and a day's parts joined any way: 15 Mar-24, 15-March 24, 15thMarch 2024, March/15/2024
Timestamps 2024-03-15T14:30:00Z, Mar 15 14:30:00, Wed, 15 Mar 2024 14:30:00 GMT
Chat and email EOD, COB Friday, on the 15th, meet Thursday

Span connectors are to, through, thru, until, till, upto, and hyphen, en dash or em dash — the last three matter because editors rewrite - as – on sight. and is not one of them: it lists periods (see below), and so do or and a slash (Jan/Feb 2024) — except between two full dates, where a slash is an ISO 8601 interval.

A relative period beside a named one counts from it. March 2024 compared to the previous month is February 2024, 2024 vs prior year is 2023, and Q1 2024 versus the same quarter last year is Q1 2023 — not periods counted back from today, which nobody named. On its own, the year before has nothing to count from, and says so.

tests/test_formats.py holds every shape above with the answer it must give, including real requests read exactly as they arrived (tests/additional_formats.txt).

<period> to date runs from the start of the period up to and including today. For the current period that is the period so far — this year to date is the same window as YTD. For one that has already ended it carries on to today, because that is what "to date" says: March 2024 to date is everything since 1 March 2024, not March alone. With no year written, a period that would start in the future means the last one instead, so December to date asked in October starts last December. An explicit future period — FY28 to date — has nothing to date yet and is refused with a diagnostic.

What it deliberately does not read

Recall is not the only thing that matters. In ordinary prose a wrong date is worse than no date, so these are left alone on purpose:

not read why
20240315 indistinguishable from invoice 20240315
sales_2024, 2024_03_15 joined by underscores, it is an identifier — a table or a file — not a date
2024.03, 3.2024 a month with a dot is an amount as often as a month; a whole day, 15.03.2024, is read
the 3rd floor, 2nd round an ordinal followed by a noun is a position, not a day
cob in lower case corn, not close of business — COB is read
19th century centuries are unsupported, and guessing a day would be worse
Christmas, Diwali holidays need a locale and a calendar of their own
every Monday, every first Monday of the month recurrence is a different shape from a range — diagnose says so. every Monday in March is still March
within 30 days of the Effective Date a duration with no anchor to measure from
bake for 30 minutes durations and times of day are out of scope
summer 2024, last winter seasons fall in different months either side of the equator
the 2015–2016 season, academic year 2015-16, the 2015-16 NBA season, SY 2015-16, academic year start, the school year end 2024 a name with months of its own, not the two years it spans — kept as a label. 2015–2016 on its own is still the years, and so is 2015-16 sales by season. AY 2015-16 is the assessment year, and is read
recently, a few days ago, the other day, the past few weeks, in recent months, a while back too vague to name a period
the year before, on its own before what? With a date beside it — 2024 vs the year before — it is read

Version numbers, prices, phone numbers, invoice IDs, scores and measurements are all left alone too. See tests/test_realworld.py for the full corpus.

Telling "nothing there" from "couldn't read it"

matches, diags = diagnose("5000 years ago", today=today)
# matches == []
# diags == [Diagnostic(text='5000 years ago', ..., reason='...outside the supported range')]

parse() never raises on user input.

substitute() is the one function that turns a flagged guess into a confident sentence, so by default it declines: anything flagged at 0.5 stays as typed.

substitute("calls tomorrow morning")                    # unchanged — 'morning' was not read
substitute("calls tomorrow morning", min_confidence=0)  # 'calls 10 October 2026 morning'
substitute("sales in 2024", min_confidence=0.9)         # 'sales in 2024' — a bare year is 0.8

Confidence is not a probability. There are five levels, each with a reason:

confidence what it means examples substitute by default
1.0 read in full, nothing in doubt last quarter, Q1 FY25, 15 March 2024, last Monday, 13/06/2018 rewritten
0.9 an all-numeric date that reads either way round — which number is the day is a setting (date_order) 03/04/2024 rewritten
0.8 probably a date, but the same words can be a plain number or name 2024, Monday, due on the 15th, 1 and 15 March 2024 rewritten
0.7 the period is certain, but no year is written, so it is the year in progress — YEAR_GUESSED September, Q1, 15 March, the first week of April rewritten
0.5 flagged: part of the phrase was not read, or a span says less than it seems — diagnose gives the reason tomorrow morning, two weeks from Friday, Q1 to January, Monday, 15 March 2024 left as typed

min_confidence defaults to 0.6, which sits between the two lowest levels: everything is rewritten except what is flagged. Pass 0 to rewrite every match, 0.75 to leave a month or quarter with no year as typed while still rewriting 1995, 0.9 to leave bare years and the like as typed too, or 1 to rewrite only what is certain. The same numbers are on every match from parse(), so code that filters on confidence uses the same scale.

A year that is not written is a guess. events in September and October names two months and no year; the year in progress is the library's guess, and on historic data it is the wrong one. So such a period reads at 0.7 rather than 1.0. A year written anywhere in the phrase is not a guess — Q1 and Q3 2024 gives Q1 the 2024, Q1 to last month is this year's Q1 — and neither is last March, which says which one it means.

A match whose neighbouring words change the period but could not be read comes back with confidence 0.5 and an explanation, rather than a confident answer to a question nobody asked:

matches, diags = diagnose("two years from March 2024", today=today)
matches[0].confidence   # 0.5
diags[0].reason         # "read 'March 2024' but not 'two years from', which changes the period"

Filter on confidence when a wrong range is worse than no range.

Two common cases land here rather than in the rules, because the range that comes back is still the most useful one available — it just isn't the whole answer:

parse("yesterday at 2pm")   # the whole day, confidence 0.5
# "read 'yesterday' but not 'at 2pm', which changes the period"

parse("Q1 to January")      # January, confidence 0.5 — under a January year Q1 adds nothing
# "read 'Q1 to January' as ..., but it ends inside the period it starts with"

Times of day are out of scope, so a date beside a clock resolves to the day. That is worth saying out loud rather than answering a question about 2pm with 24 hours. Only a preposition counts — at, by, around. A clock sitting straight against a date is part of a timestamp (2024-03-15T14:30:00Z, Mar 15 14:30:00), where the day is the intended answer, so log lines stay at full confidence.

and lists periods; to makes a span. Q1 and Q3 is two periods, each returned on its own — one range for both would hold Q2, which nobody named — and so are Q1 and Q2, FY24 & FY25, Monday and Friday and this year and Q1, exactly as Q1, Q2 and Q3 is. Q1 to Q3, from March to June and between March and June are spans, from the start of the first to the end of the last, wrapping a year if they invert; between … and is the one place and makes a span. A list may hold spans of its own — Jan to Mar and Jul to Sep is two — and a year written on one item reaches the others: Q1 and Q3 2024.

substitute("revenue Q1 and Q3")
# 'revenue January 2026 to March 2026 and July 2026 to September 2026'
substitute("revenue Q1 and Q3", keep_text=True)
# 'revenue Q1 (January 2026 to March 2026) and Q3 (July 2026 to September 2026)'

Days that share a month are a list too: 1st and 15th March, 1, 5 and 9 March 2024, March 1 and 15, 1st vs 15th March. Each day comes back on its own, with the month and any year it shares. A bare number before the month — 1 and 15 March — reads at confidence 0.8, since top 3 and 15 March would read the same way; a suffix or a month in front (1st and 15th, March 1 and 15) settles it. between 1 and 15 March is a run.

A span whose end lies at its own start comes back at confidence 0.5 rather than being guessed at: under a January year Q1 to January is just January, so Q1 added nothing. A span that stops partway through its first period is fine: Q1 to 15 March is a reasonable question.

Bare last day is yesterday — "the last day", read as "the last 1 day". With a period after it, the last day of the month is the month's final day; on its own it is ambiguous enough that, if it matters, write yesterday or name the period.

Precision on running prose

Bare month names are the dominant false positive for this kind of library — strictness controls how eagerly they are claimed:

parse("the march on Washington")        # [] — no cue, so "march" is a noun
parse("sales in March")                 # matched — "in" is a cue
parse("the March figures")              # matched — the cue can follow, too
WranglerConfig(strictness="greedy")       # match any month name anywhere
WranglerConfig(strictness="strict")       # require a year or explicit period marker

June, May and April are also people

Four month names are common given names, so a cue alone is not enough — sales by June Patel has a perfectly good cue in by. Four signals override it, each sufficient on its own:

parse("sales by June Patel")     # [] — a capitalised surname follows
parse("for Dr. May Chen")        # [] — a title precedes
parse("in June's laptop")        # [] — possessive over a noun no month owns
parse("for April said otherwise")  # [] — a verb only people perform

The possessive test turns on the noun, so March's figures and June's revenue stay dates. Copulas are deliberately excluded from the verb list — sales in June was strong has to keep working — and June Quarter is not read as a surname.

This is shape, not meaning: there is no name list and no grammar model, so a genuinely ambiguous sentence like June saw record sales still reads as the month. The aim is to stop the confident errors, not to resolve English. strictness="greedy" bypasses all of it; strict needs an explicit year or period marker and never guesses.

Rewriting text

Two ways, picked with keep_text:

substitute("sales of Q4", today=today)
# 'sales of October 2025 to December 2025'           — the dates replace the phrase

substitute("sales of Q4", today=today, keep_text=True)
# 'sales of Q4 (October 2025 to December 2025)'      — the phrase, then its dates

Only the matched phrase is touched. keep_text=True is usually the better choice when a model or a person reads the result: the label survives — "Q4" still says quarter, which matters for grouping and for how an answer is worded — and the dates beside it show exactly which reading was taken, fiscal or calendar. formatter sets how the dates look in either mode, and min_confidence leaves flagged phrases as typed in either mode.

With keep_text, a phrase is left alone when the brackets would only repeat it (March 2024), or when it is already followed by dates in brackets — written by an earlier pass, on any day and with any formatter, or by the writer (Q4 (2024)). So running it again on its own output adds nothing:

once = substitute("compare Q1 2024 to Q1 2025", keep_text=True)
# 'compare Q1 2024 (January 2024 to March 2024) to Q1 2025 (January 2025 to March 2025)'
substitute(once, keep_text=True) == once   # True

One limit worth knowing, for the default mode only. Replacing is textual, so the inserted dates can fuse with a neighbouring token that was never part of a date:

substitute("sales 15 Q1")                  # 'sales 15 January 2025 to March 2025'
substitute("sales 15 Q1", keep_text=True)  # 'sales 15 Q1 (January 2025 to March 2025)'

Read the first back and 15 January 2025 is a perfectly good date, so a second pass gives a different answer. Repeated replacing always converges — it never grows without bound, which is the failure that matters — but it is not idempotent in one pass when a bare number abuts a date expression. keep_text does not have the problem, because the phrase stays where it was. When exactness matters, use parse() and render the ranges yourself; substitute is a convenience.

Output format

Formatting is a separate, replaceable function, so the output format and structure are entirely yours. Three levels, in increasing order of control:

1. Don't format at all. The dates are already objects — m.range.start, m.range.end, m.range.grain. Most callers never need a string.

2. make_formatter() — build one from format strings:

from date_wrangler import make_formatter

make_formatter()(r)                                          # '2024-04-01 to 2024-06-30'
make_formatter(date_format="%d/%m/%Y", closed="{start} - {end}")(r)
                                                             # '01/04/2024 - 30/06/2024'
make_formatter(closed="BETWEEN '{start}' AND '{end}'")(r)
                                                # "BETWEEN '2024-04-01' AND '2024-06-30'"
make_formatter(closed="[{start}, {end}]", inclusive_end=False)(r)
                                                             # '[2024-04-01, 2024-07-01]'

date_format is a strftime pattern; the templates are str.format patterns taking {start} and {end}. Separate templates exist for each shape — closed, single, since, until, before, after, as_of, unbounded.

inclusive_end decides which day {end} names. It defaults to True, so a human-facing string says the last day inside the period (2024-06-30); set it False to emit the exclusive bound (2024-07-01) for a machine.

A coarse date_format never overstates a range. With date_format="%B %Y", a YTD asked on 15 October would read January 2026 to October 2026 — which says all of October, sixteen days it does not cover. When the format cannot show a day and the range does not sit on whole months, both ends fall back to day_format ("%Y-%m-%d" by default):

fmt = make_formatter(date_format="%B %Y")
fmt(last_quarter)   # 'July 2026 to September 2026'   — whole months, as asked
fmt(ytd)            # '2026-01-01 to 2026-10-15'      — partial, so days
make_formatter(date_format="%B %Y", day_format=None)(ytd)
                    # 'January 2026 to October 2026'  — you asked for exactly this

The default date_format already shows days, so nothing changes unless yours is coarse.

3. Any callable. A formatter is just DateRange -> str:

substitute(text, formatter=lambda r: f"<{r.start}..{r.end})")

Built-ins: format_range (prose, locale-independent) and format_iso (2024-04-01/2024-07-01).

Command line

$ date-wrangler --today 2025-09-04 "revenue since Q1 FY25"
'since Q1 FY25'
   from April 2024 onwards
   2024-04-01/..   grain=quarter basis=fiscal mod=since confidence=1
   SQL: d >= '2024-04-01'

--fiscal-start, --label-by, --year-basis, --date-order, --month-number, --week-starts-on, --anchor, --weekend, --holidays and --strictness to try configurations. A setting you leave out that changed an answer is reported on stderr. --json prints the same answer an agent's tool call gets: see below.

From an AI agent

Models get date arithmetic wrong in quiet ways: a fiscal year that starts in April, "last week" starting on a Sunday, an exclusive end read as the last day. date-wrangler gives an agent one tool, resolve_dates, that does the arithmetic and says what it assumed. Every decision is made in the library; the tool definition, the MCP server and the skill below only expose it, so all three give the same answer.

Q3 FY24, with nothing but today given, comes back as (shortened):

{
  "matches": [
    {"text": "Q3 FY24", "first_day": "2023-10-01", "last_day": "2023-12-31",
     "reads_as": "October 2023 to December 2023", "confidence": 1.0, "notes": [],
     "relative_to_today": false, "range": {"start": "2023-10-01", "end": "2024-01-01", "...": "..."}}
  ],
  "assumptions": [
    {"setting": "fiscal_start_month", "assumed": 4,
     "note": "The fiscal year is taken to start in April. Pass fiscal_start_month if ...",
     "matches": [{"text": "Q3 FY24", "span": [0, 7]}]},
    {"setting": "fiscal_year_label", "assumed": "end_year", "note": "...",
     "matches": [{"text": "Q3 FY24", "span": [0, 7], "otherwise": [
       {"value": "start_year", "reads_as": "October 2024 to December 2024",
        "first_day": "2024-10-01", "last_day": "2024-12-31"}]}]}
  ],
  "diagnostics": []
}

An assumption is listed only when it changed an answer: the text is read again with the setting at its other values, and a default that moved no date is not reported. 03/04/2024 reports the day-first order and the US reading; 13/04/2024, which has only one reading, reports nothing. The settings tried are the fiscal start month (all twelve) and label, the year basis, the date order, what jan 24 means, the century of a two-digit year (against the 1930-2029 that Windows and Excel use), the week start (Monday, Sunday, Saturday), anchoring, today, and, for business days, the weekend and holidays. Each other reading changes that one setting and keeps the rest. The year basis is also tried with the fiscal year starting in every month, when the start month was left out too: last quarter is the calendar's on an April year and three other months on a February one, so it is listed, with no single other reading to give and a note to pass both. first_day and last_day are inclusive, for quoting; range.end stays exclusive, for code. Arguments a model gets wrong raise ToolInputError with a message naming what to change, to hand back as the tool's error result. tool.OUTPUT_SCHEMA describes the answer as JSON Schema.

A call reads the text several times where parse() reads it once: a few milliseconds, nothing beside a model's turn, but parse() is the one for bulk work.

A tool for your own agent

date_wrangler.tool holds the definition, plain JSON Schema inside what strict tool use accepts, and call(), which runs it on the arguments a model sends:

import json

import anthropic
from date_wrangler import tool

client = anthropic.Anthropic()
messages = [{"role": "user", "content": "What are the dates of Q3 FY24? Our year starts in July."}]
while True:
    response = client.beta.messages.create(
        model="claude-opus-5-5",
        max_tokens=16000,
        tools=[{**tool.definition(), "strict": True}],
        messages=messages,
        # If a request is declined, it is retried on a fallback model.
        betas=["server-side-fallback-2026-07-01"],
        fallbacks="default",
    )
    if response.stop_reason != "tool_use":
        break
    messages.append({"role": "assistant", "content": response.content})
    results = []
    for block in response.content:
        if block.type == "tool_use":
            try:
                content, is_error = json.dumps(tool.call(block.input)), False
            except tool.ToolInputError as exc:
                content, is_error = str(exc), True
            results.append({"type": "tool_result", "tool_use_id": block.id,
                            "content": content, "is_error": is_error})
    messages.append({"role": "user", "content": results})
print("".join(b.text for b in response.content if b.type == "text"))

Other model APIs take the same schema under their own key: parameters for OpenAI-style function calling, inputSchema for MCP. Frameworks that build a tool from a function's signature can wrap tool.resolve_dates, which takes the same arguments as keywords.

Your organisation's settings

A host that already has a WranglerConfig passes it whole, and the tool then reads exactly what parse() reads under it — of_year_basis and all, which no tool argument can say:

cfg = WranglerConfig(fiscal=FiscalCalendar(4), year_basis="fiscal", of_year_basis="calendar")
tool.call(block.input, config=cfg)                  # "H1 of 2022" is January to June 2022
tool.resolve_dates("Q1 FY26", config=cfg, comparisons=True)

Every setting in the config counts as given, so none is tried or reported as an assumption; an argument the model sends overrides the config's for that call. With comparisons=True each match also carries comparisons: {previous, year_earlier}, each with its first and last day, or null for an open-ended range — inside the match, under its own name, so a model cannot take it for a date the question named. Both switches are for the host, not in the schema the model sees.

To tell the model how dates are read before it writes anything itself — a SQL condition, say — put describe(cfg) in its prompt. Every example in the words is the library's own reading on that day, so they cannot disagree with the tool:

from date_wrangler import describe

describe(cfg, today=date(2026, 11, 17))
# 'A year here is the fiscal year, April to March, named by the year it ends in: "2024" is
#  April 2023 to March 2024, as "FY2024" is. ... A half or quarter "of" a year is the
#  calendar one: "H1 of 2025" is January 2025 to June 2025. A month with no year is in the
#  fiscal year in progress: on Tuesday 17 November 2026, "January" is January 2027 ...
#  All-number dates are day first: "08/04/2026" is 8 April 2026. ...'

An MCP server

pip install "date-wrangler[mcp]"

installs date-wrangler-mcp, a stdio MCP server with the one tool. The extra brings the MCP SDK and its web stack; a plain install still has none of it. In Claude Code:

claude mcp add --transport stdio --scope user date-wrangler -- date-wrangler-mcp

Claude Desktop and other clients take it in their MCP configuration:

{"mcpServers": {"date-wrangler": {"command": "date-wrangler-mcp"}}}

Or without installing anything first: uvx --from "date-wrangler[mcp]" date-wrangler-mcp. The server takes today from the machine it runs on unless the model passes today. It declares the answer's shape as the tool's output schema, and returns it as structured content and as JSON text.

A skill

skills/date-wrangler is an Agent Skill: it tells Claude when to resolve dates, which flags carry an organisation's settings, and how to read and report the answer, using the command line. It holds no date logic of its own. For Claude Code, copy the folder into ~/.claude/skills/ for yourself, or into a project's .claude/skills/; it can also be uploaded through the Skills API. Wherever it runs needs date-wrangler installed, or a way to install it: in a sandbox with no network access, use the tool definition or the MCP server instead.

Development

pip install -e ".[dev,mcp]"
pytest

Without the mcp extra the MCP server's tests are skipped and everything else runs.

License

MIT © 2026 Steephan Selvaradjou — see LICENSE.

Metadata

Release files for date-wrangler 2.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for date-wrangler 2.6.0
File Size Uploaded Provenance Actions
date_wrangler-2.6.0.tar.gz 402.0 kB With provenance Details for date_wrangler-2.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for date-wrangler 2.6.0
File Interpreter ABI Platform Actions
date_wrangler-2.6.0-py3-none-any.whl Python 3 none any Details for date_wrangler-2.6.0-py3-none-any.whl

Total release size: 580.9 kB

Release files / date_wrangler-2.6.0.tar.gz

Download URL date_wrangler-2.6.0.tar.gz
Size 402.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d0225cb6b339b74abf9d60f448f1f27b5d41082c5720cd0819c37f6db1026eca
BLAKE2b-256 checksum
How to use checksums
c3d77556519ff45672bbc0f722b33f015d822b90e6a50f9d8ad522c5f7160c92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / date_wrangler-2.6.0-py3-none-any.whl

Download URL date_wrangler-2.6.0-py3-none-any.whl
Size 178.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1fb89078e299c10a09358f7ffe7bd5a5d89a7df1a6e60f600243b7fef09b0c8b
BLAKE2b-256 checksum
How to use checksums
630ac3139796d421b753d47185852a7c0f72200b30607daebbeab62526ebc122
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for date-wrangler 2.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for date_wrangler-2.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page