AlexandrAI AGENTS.md
agents-md

AlexandrAI Tools Time Unit Converter Agent Guide

Agent guide for duration conversion across milliseconds, seconds, minutes, hours, days, weeks, and Julian years.

AGENTS.md

Guidance for coding agents working on AlexandrAI Tools Time Unit Converter in the alexandrai-tools project.

Project overview

This guide covers src/tools/time-unit-converter/index.ts. The tool converts ms, s, min, hour, day, week, and year through a seconds factor table. A year is defined as a Julian year of 365.25 days, and pure conversion returns unrounded numeric results.

Primary source files

  • src/tools/time-unit-converter/index.ts defines meta, TimeUnit, TIME_UNITS, TO_S, and convert.
  • src/tools/time-unit-converter/index.test.ts covers minutes, days, hours, weeks, milliseconds, identity conversion, and hours to minutes.
  • src/tools/time-unit-converter/Body.astro owns browser controls.
  • src/tools/time-unit-converter/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 seconds as the base unit.
  • Keep ms as 0.001 s.
  • Keep min as 60 s and hour as 3600 s.
  • Keep day as 86400 s and week as 604800 s.
  • Keep year as 31557600 s, representing 365.25 days.
  • Do not round in pure convert.
  • If calendar-aware months or years are added, keep them separate from fixed-duration units.

Testing

Test 1 min to 60 s, 1 hour to 3600 s, 1 day to 86400 s, 1 week to 7 days, 1000 ms to 1 s, 1 hour to 60 min, year to days, identity, zero, fractional durations, and negative durations if supported.

PR checklist

  • npm test passes for time-unit-converter.
  • Conversion constants remain traceable and tested.
  • Identity conversions and rounding behavior remain documented.
  • UI labels, unit arrays, and pure conversion logic stay in sync.