ChronoKit-FP decision guides

Choose a value type#

If you mean…UseAvoid
A calendar dateTDateTime at midnight via EncodeDateAdding a timezone that the task does not need
A local wall clockTDateTime via EncodeDateTime or GetNowAssuming it keeps a timezone name
“One month” or “two calendar days”TCalendarPeriodConverting months or years into seconds
Exact elapsed timeTDurationA calendar period when elapsed milliseconds matter
A scheduled windowTDateTimeRangeAn inclusive end boundary when adjacent windows must touch safely
Holiday and work-week rulesTBusinessCalendarRepeating weekday checks throughout an application

Choose an operation#

NeedPreferred operationKey rule
Add one calendar unitAddDays, AddMonths, other Add*A negative amount subtracts
Add several calendar componentsCreateCalendarPeriod then AddPeriodMonths remain calendar-aware
Add elapsed time or measure itAddDuration or DurationBetweenDurations are exact milliseconds
Find a period boundaryStartOf or EndOfAn EndOf* result is the final millisecond
Test an intervalCreateRange and range operationsRanges are [start, end)
Find working daysAddBusinessDays or BusinessDaysBetweenCounting includes qualifying endpoints; adding does not count its start
Convert system-local to a named targetSystemLocalToTimeZoneInput belongs to the computer's system zone
Convert named source to system-localTimeZoneToSystemLocalInput belongs to the named source zone
Convert a named source to a named targetConvertBetweenTimeZonesInput is a source-zone wall clock; output is the same instant in target-zone fields

Understand validation and timezone errors#

SituationResultWhat to do
Text cannot match its explicit parse formatEConvertErrorShow the expected format and let the user correct the input
A custom calendar has no working daysEBusinessCalendarErrorSelect at least one TBusinessWeekday
A range ends before it startsEArgumentExceptionCorrect the ordering; equal endpoints are a valid empty range
Timezone name is empty, unsupported, or lacks dataETimeZoneErrorUse UTC or a name from GetTimeZoneNames on that platform
Source clock is in a DST forward gapETimeZoneErrorAsk for a real local time
Source clock is in a DST backward overlapETimeZoneErrorAsk the user to choose an unambiguous time; TDateTime cannot carry which occurrence they meant

Catch error classes, not message text. See the timezone contract for supported names and exact DST rules.