Skip to main content

WeeksPerYear

WeeksPerYear = 52

Example

function IsOrdinaryWeekNumber(const WeekNumber: Integer): Boolean;
begin
Result := (WeekNumber >= 1) and (WeekNumber <= WeeksPerYear);
end;

Usage

WeeksPerYear defines a legacy 52-week approximation for a year and must not be used as the exact ISO week count.

Additional Technical Info

The Velox DateUtils importer registers WeeksPerYear as a signed LongInt literal. It represents the 52 complete seven-day blocks contained in every civil year. It is not the exact length of that year: 52 weeks contain 364 days, leaving one day in a common year and two in a leap year.

It is also not the maximum ISO week number. ISO week-numbering years can have week 53, according to the position of year boundaries. Use WeeksInAYear or the DecodeDateWeek family when ISO validity matters.

The current installed Delphi DateUtils source no longer declares this WeeksPerYear constant, although Velox deliberately continues to register the literal. Do not assume current RTL algorithms cap a week number at 52.

The example deliberately calls values 1..52 "ordinary" rather than universally valid; it would reject a legitimate ISO week 53. It is source-reviewed only and was not executed.

Related Code Library entries

External references

Created 2026-07-15