AlexandrAI AGENTS.md
agents-md

AlexandrAI Tools Business Days Agent Guide

Agent guide for inclusive and exclusive weekday counts between two YYYY-MM-DD dates.

AGENTS.md

Guidance for coding agents working on AlexandrAI Tools Business Days in the alexandrai-tools project.

Project overview

This guide covers src/tools/business-days/index.ts. The tool converts dates to UTC epoch days, sorts endpoints, reports inclusive total calendar days, chooses an inclusive or exclusive counting window, and counts Monday through Friday using full-week arithmetic plus a partial-week remainder.

Primary source files

  • src/tools/business-days/index.ts defines meta, BusinessDaysResult, isoToEpochDay, epochDayToWeekday, and countBusinessDays.
  • src/tools/business-days/index.test.ts covers inclusive weekday spans, weekends, same-day weekdays, two full weeks, order independence, month crossing, exclusive endpoints, adjacent dates, and invalid dates.
  • src/tools/business-days/Body.astro owns browser controls.
  • src/tools/business-days/i18n.ts owns localized copy.
  • src/lib/tools.ts registers metadata.

Setup commands

npm install npm test npm run typecheck npm run build npm run dev

Change rules

  • Use UTC epoch days for date math.
  • Sort input dates internally so order does not matter.
  • Report totalDays as inclusive calendar days from start to end.
  • When inclusive is true, count both endpoints if they are weekdays.
  • When inclusive is false, exclude both endpoints.
  • Count only Monday through Friday as business days.
  • If holidays are added, keep them as an explicit option and do not alter base weekday behavior.

Testing

Test Monday-Friday, Monday-Sunday, weekend-only spans, same-day weekday, same-day weekend, two full weeks, reversed inputs, exclusive endpoint spans, adjacent dates, month crossings, invalid format, and future holiday exclusion.

PR checklist

  • npm test passes for business-days.
  • Timezone, UTC, and rounding behavior remain documented.
  • Invalid-input behavior is covered by tests.
  • UI labels, metadata, and pure date or time logic stay in sync.