FEATURE: Date and Time Builtins
| Field | Value |
|---|---|
| Version | 20261028 V1 |
| Description | Provide jq date parsing, formatting, and time conversion. |
| Depends On | FEATURE-Numeric.md |
| Provides | jq date builtins |
| Consumes | jq numeric builtins |
Purpose
Implement the date and time filters exercised by the corpus, following the jq manual and builtin reference.
Behavior
- Parse and format dates with
strptime,strftime, andstrflocaltime; implement the ISO 8601 aliases and epoch conversions. - Represent broken-down time in jq's array order, with zero-based month and the specified weekday and year-day conventions. Support the input forms and fractional seconds exercised by the corpus.
- Apply UTC semantics to UTC functions and local-time semantics to local functions. Invalid formats or broken-down values raise the specified runtime errors.
- Preserve argument streams and output order.
Programmatic Acceptance
=== AC dates-corpus ===
Intent: Date parsing, formatting, and time conversion pass their executing corpus slice.
Suite: scoped
Requires: executable=python3; scope=test
Probe: --list
Probe Count: summary
import json import os import subprocess import sys
SELECT = r"\b(?:strftime|strflocaltime|strptime|mktime|gmtime)\b" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", SELECT, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": os.path.abspath("jq")}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) tally = report["summary"] assert sum(tally.values()) > 0, f"selector matched no case: {SELECT}" assert tally["fail"] == 0 and tally["error"] == 0, tally assert result.returncode == 0, result.returncode === END AC dates-corpus ===
User Acceptance
- None.
Guardrails
- Use only the Python standard library and preserve the manual's time semantics.
- Do not alter staged source assets.