Skip to main content

Module timezone

Module timezone 

Source
Expand description

DST timezone helpers for German MESZ/MEZ validation.

EU DST rule: MESZ (summer time) starts the last Sunday of March at 01:00 UTC, and ends the last Sunday of October at 01:00 UTC.

Functions§

dst_transitions_between
Net DST delta across two UTC instants (expressed in epoch minutes).
dtm_after
Whether a DTM value (format 303 or 102) lies after a format-303 reference, such as the document date in DTM+137. A 102 day lies after it when it begins after it — a later German calendar day.
dtm_not_after
Whether a DTM value lies no later than a format-303 reference, such as the document date in DTM+137 ([495] “Der Zeitpunkt muss ≤ dem Wert im DE2380 des DTM+137 sein”). A 102 day qualifies when it begins no later — the reference’s German day or one before ([515]); a 304 instant compares to the second. Comparing the strings put 20241115230000+00 (304) after 202411152300+00, since 0 sorts after +.
dtm_start_utc_min
UTC epoch minutes at which a DTM value begins: the instant itself for format 303 (CCYYMMDDHHMM, UTC), the German midnight that starts the day for format 102 (CCYYMMDD, a calendar day in German time).
is_mesz_utc
Returns True if the given CCYYMMDDHHMM value falls within German summer time (MESZ), False if it falls in winter time (MEZ), or Unknown if the input is invalid/too short.
is_mez_utc
Returns True if the given CCYYMMDDHHMM value falls within German winter time (MEZ).
parse_dtm303
Parse EDIFACT DTM format 303 (CCYYMMDDHHMM, already UTC per BDEW convention) into UTC epoch minutes. Any timezone suffix (e.g. +00, UTC) is ignored — BDEW values are always UTC.