Determines whether a given date falls within US daylight saving time under the federal rule, and reports that year's transition dates.
Published for review. The Founder is checking every card himself; anything he strikes comes down the same hour.
Try it
Inputs
date (string, required) : ISO 8601 date to check, YYYY-MM-DD (year must be 2007 or later, when the current US rule took effect)
Outputs
dst_in_effect: True if the date falls within US daylight saving time
dst_start: Second Sunday in March of that year, when DST begins
dst_end: First Sunday in November of that year, when DST ends
Steps
Parse the date as a proleptic Gregorian civil date.
Find the second Sunday of March and the first Sunday of November of the same year, using ISO weekday parity from the day-number kernel (Hinnant days_from_civil, cited above).
DST is in effect for dates on or after the second Sunday of March and before the first Sunday of November.
This method takes a date only (no time of day): the Act's transitions occur at 2:00 a.m. local time, so this method treats the start date itself as already in DST and the end date itself as already back to standard time.
Constants
dst_start_rule = second Sunday in March rule (source: Energy Policy Act of 2005, Section 110 (daylight saving time))
dst_end_rule = first Sunday in November rule (source: Energy Policy Act of 2005, Section 110 (daylight saving time))
rule_effective_from_year = 2007 year (source: Energy Policy Act of 2005, Section 110 (daylight saving time))
Sources
Energy Policy Act of 2005, Section 110 (daylight saving time) (United States Code, 2026-09-30T19:41:35Z) - sets US DST from the second Sunday in March to the first Sunday in November, transitions at 2:00 a.m. local time, effective 2007 onward