dst-transition-reference
БесплатноБез исполняемых скриптовНе проверенUse for any question or task about daylight saving time in code or tests, including quick ones: what breaks on DST transition days, naive datetimes plus a…
от testland★ 18 звёзд на GitHubОб этом скилле
dst-transition-reference
Overview
DST transitions cause a large share of production time-bugs: spring-forward creates non-existent local times, fall-back creates duplicate local times. The IANA Time Zone Database (iana.org/time-zones) is the canonical source of historical and current DST rules.
How to use this reference
- Identify the transition the code crosses - spring-forward (skipped hour) or fall-back (repeated hour) - from the DST mechanics section below.
- Match the bug class the code is exposed to (cron, billing, duration arithmetic, recurring meeting, storage) and apply its mitigation.
- Turn it into an assertion using the testable-behaviours table - construct the transition timestamp and assert the library's documented result (see the worked example).
- Pick zones + fixture timestamps from references/jurisdictions-and-fixtures.md, then refresh them against IANA before each release.
When to use
- Designing time-handling code that crosses DST boundaries.
- Auditing existing code for DST-safety.
- Writing test cases that exercise DST behaviour.
- Investigating "scheduled job ran twice / didn't run" reports.
DST mechanics
Spring-forward (skipped hour)
Per en.wikipedia.org/wiki/Daylight_saving_time, in US Eastern: on the 2nd Sunday of March, at 02:00 local time the clock jumps to 03:00. The 02:00-02:59 hour does not exist in local time.
Tests against 2026-03-08 02:30 America/New_York produce
ambiguous or invalid results depending on library:
| Library | Behaviour at non-existent local time |
|---|---|
Python pytz (legacy) |
localize(dt, is_dst=None) raises NonExistentTimeError; the default localize(dt) guesses instead of raising |
Python zoneinfo (3.9+) |
Keeps the wall time 02:30; fold=0 uses the pre-transition offset (02:30-05:00 EST), which is 03:30 EDT once converted (PEP 495) |
Java ZonedDateTime |
Constructor takes a resolver: STRICT / SMART_BACKWARD / SMART_FORWARD |
| JS Intl | Browsers vary; often returns the post-transition time |
Fall-back (repeated hour)
In US Eastern: 1st Sunday of November at 02:00 local time, the clock falls back to 01:00. The 01:00-01:59 hour occurs twice - once as EDT (UTC-4), once as EST (UTC-5).
2026-11-01 01:30 America/New_York is ambiguous. Libraries
either:
- Pick one:
zoneinfodefaults tofold=0, the first occurrence (EDT); pytz's defaultlocalize(dt)guesses (its docs example gives01:30:00 EST-0500, the second occurrence) and warns of "a 50% chance of it being out by one hour" - Raise an error
- Take an
is_dst/foldflag (Python 3.6+ hasfold=0|1)
Worked example - a spring-forward assertion
Goal: prove the code under test handles a non-existent local time deterministically.
- Pick the transition: America/New_York spring-forward on 2026-03-08 - 02:00 local jumps to 03:00, so 02:00-02:59 does not exist.
- Construct
2026-03-08 02:30 America/New_Yorkin the code path. - Assert against the library's documented behaviour (from the table
above):
- Python
zoneinfokeeps 02:30 and, with the defaultfold=0, attaches the pre-transition offset: assertdt.utcoffset() == timedelta(hours=-5)and thatdt.astimezone(timezone.utc)is 07:30 UTC (03:30 EDT once converted back). Never assert that the object itself reads 03:30. - Python
pytzraisesNonExistentTimeErroronly withlocalize(dt, is_dst=None)- passis_dst=Noneand assert the raise. - Java
ZonedDateTimeapplies its resolver - assert per the chosen STRICT / SMART_FORWARD rule.
- Python
- Repeat for fall-back:
2026-11-01 01:30 America/New_Yorkoccurs twice; assert thefold/is_dstselection picks the intended offset.
Per-jurisdiction differences
Per-region DST rules (US, EU, Australia, and the growing list of regions that abolished DST) and refreshable 2026 fixture timestamps live in references/jurisdictions-and-fixtures.md. Per IANA, rules change frequently - test against current zoneinfo, not assumptions.
Common bug classes
Cron jobs
A "daily at 02:30" cron in America/New_York:
- Spring-forward day: doesn't fire (02:30 doesn't exist).
- Fall-back day: fires twice (02:30 EDT, then 02:30 EST).
Mitigation:
- Use UTC cron expressions when possible.
- For local-time business hours, accept the irregularity or schedule outside transition hours (04:00 is safe everywhere).
- Per
cron-job-test-author(in the qa-async-jobs plugin): always test DST + leap-day edge cases.
Billing periods
"Bill on the 1st of each month at 00:00 local time":
- Fine in jurisdictions without DST.
- Risk in DST-observing: 00:00 local on Nov 1 (US) might overlap with the fall-back hour if billing involves more than one e
Установить dst-transition-reference в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл dst-transition-reference?
Use for any question or task about daylight saving time in code or tests, including quick ones: what breaks on DST transition days, naive datetimes plus a duration, jobs or reports an hour off after the clocks change, cron jobs that fire zero or two times. Covers skipped and repeated hours, jurisdiction differences, the IANA tz database, billing and meetings on transition days, leap seconds and clock smearing.
Как установить скилл dst-transition-reference?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл dst-transition-reference запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic