TIP #444: Add "weekdays" unit in clock add

Title:Add "weekdays" unit in clock add
Version:$Revision: 1.6 $
Author:Pietro Cerutti <gahr at gahr dot ch>
Created:Tuesday, 23 February 2016


This TIP proposes an enhancement to the clock add command to support performing days arithmetic using weekdays only.


The clock add command allows to perform time arithmetic using a variety of time units, including days. However, it offers no easy way to skip weekends. It is often desired to perform weekdays arithmetic that involves adding or subtracting a number of non-weekend days to a certain date. This is useful in example when computing delivery dates.


The weekdays time-unit is added to the list accepted by the clock add command. The count argument represents weekdays (Mon-Fri) to be added (or subtracted in case of a negative value) to the date. The result of adding weekdays to a date is never a weekend day, unless the starting day is itself a weekend day and count is 0.

Reference Implementation

Available at http://core.tcl.tk/tcl/timeline?t=tip-444


A point has been raised as to whether weekday is unambiguous enough. For instance, in Sweden there seems to be some disagreement on whether the translation vardag includes Saturdays. As an alternative, the term workday has been mentioned. This, however, has the downside of introducing the concept of working days vs. public holiday. Also, the working week is not Mon-Fri in all countries, see [1].

TIP does not try to accomodate locale-specific features and characteristics. For this reason, it seems best to stick to weekday as the name of the unit and specifically mention that (Mon-Fri) is intended in the documentation.


This document has been placed in the public domain.

Powered by Tcl[Index] [History] [HTML Format] [Source Format] [LaTeX Format] [Text Format] [XML Format] [*roff Format (experimental)] [RTF Format (experimental)]

TIP AutoGenerator - written by Donal K. Fellows