DST-Safe Arithmetic
Problem
A wall-clock value during a DST transition is not an instant until you choose a timezone and disambiguation strategy.
Solution
Parse the wall-clock value explicitly, resolve it with timeZone and disambiguation, then shift the zoned value.
ts
import { parse, shift, toInstant } from '@vielzeug/tempo';
const wallClock = parse('2026-11-01T01:30:00', { as: 'plainDateTime' });
const instant = toInstant(wallClock, {
disambiguation: 'later',
timeZone: 'America/New_York',
});
const nextHour = shift(instant, { hours: 1 }, { timeZone: 'America/New_York' });Pitfalls
- Pass
timeZonefor every plain date or plain date-time conversion. - Choose
disambiguation: 'reject'when ambiguous local input must fail.