Functional Weave
Code in Python

dates.add-business-days@1.0.0

vectors.json

2,634 bytes · view raw

[
  { "name": "Tuesday plus one working day is Wednesday", "args": ["2026-09-22", 1, []], "expect": "2026-09-23" },
  { "name": "Friday plus one working day is Monday", "args": ["2026-09-25", 1, []], "expect": "2026-09-28" },
  { "name": "Saturday plus one is also Monday: the start is never counted", "args": ["2026-09-26", 1, []], "expect": "2026-09-28" },
  { "name": "Tuesday plus five working days is the next Tuesday", "args": ["2026-09-22", 5, []], "expect": "2026-09-29" },
  { "name": "Monday minus one working day is the previous Friday", "args": ["2026-09-28", -1, []], "expect": "2026-09-25" },
  { "name": "Sunday minus one is Friday", "args": ["2026-09-27", -1, []], "expect": "2026-09-25" },
  { "name": "zero leaves a Saturday where it is rather than rolling it", "args": ["2026-09-26", 0, []], "expect": "2026-09-26" },
  { "name": "Christmas Eve 2026 plus one skips Christmas Day and the Boxing Day substitute", "args": ["2026-12-24", 1, ["2026-12-25", "2026-12-28"]], "expect": "2026-12-29" },
  { "name": "Easter 2026 in England: Maundy Thursday plus one is the Tuesday", "args": ["2026-04-02", 1, ["2026-04-03", "2026-04-06"]], "expect": "2026-04-07" },
  { "name": "and back again: Easter Tuesday minus one is Maundy Thursday", "args": ["2026-04-07", -1, ["2026-04-03", "2026-04-06"]], "expect": "2026-04-02" },
  { "name": "ten working days over Christmas and New Year needs the next year's holidays", "args": ["2026-12-21", 10, ["2026-12-25", "2026-12-28", "2027-01-01"]], "expect": "2027-01-07" },
  { "name": "a holiday on a Saturday is not skipped twice", "args": ["2026-09-25", 1, ["2026-09-26"]], "expect": "2026-09-28" },
  { "name": "duplicates and order in the holiday list do not matter", "args": ["2026-12-24", 1, ["2026-12-28", "2026-12-25", "2026-12-25"]], "expect": "2026-12-29" },
  { "name": "a holiday on the start date does not change a forward move", "args": ["2026-12-25", 1, ["2026-12-25", "2026-12-28"]], "expect": "2026-12-29" },
  { "name": "a leap day is an ordinary working day", "args": ["2024-02-28", 1, []], "expect": "2024-02-29" },
  { "name": "twenty working days is four calendar weeks with no holidays", "args": ["2026-09-22", 20, []], "expect": "2026-10-20" },
  { "name": "a malformed holiday fails even when the move never reaches it", "args": ["2026-09-22", 1, ["2030-02-30"]], "expectError": "is not a real calendar date" },
  { "name": "a fractional day count is an error", "args": ["2026-09-22", 1.5, []], "expectError": "days must be an integer" },
  { "name": "a UK-style start date is an error", "args": ["22/09/2026", 1, []], "expectError": "is not an ISO date" }
]