ondrej-merkun/skill-audit / test/fixtures/benign/date-parser
date-parser
Verifiedparse.py
View on GitHub"""Date parsing and formatting utilities — pure stdlib."""
from datetime import datetime, timedelta, timezone
FORMATS = [
"%Y-%m-%dT%H:%M:%S",
"%Y-%m-%d",
"%m/%d/%Y",
"%d.%m.%Y",
"%a, %d %b %Y %H:%M:%S %z",
]
def parse(date_string: str) -> datetime:
date_string = date_string.strip()
for fmt in FORMATS:
try:
return datetime.strptime(date_string, fmt)
except ValueError:
continue
raise ValueError(f"Unrecognised date format: {date_string!r}")
def to_iso(date_string: str) -> str:
return parse(date_string).isoformat()
def diff_days(date1: str, date2: str) -> int:
return abs((parse(date1) - parse(date2)).days)
def add_days(date_string: str, n: int) -> str:
return (parse(date_string) + timedelta(days=n)).isoformat()
def now_utc() -> str:
return datetime.now(tz=timezone.utc).isoformat()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |