timer icon indicating copy to clipboard operation
timer copied to clipboard

feat: add time-based timer functionality with comprehensive testing (closes #6)

Open linkzera opened this issue 8 months ago • 0 comments

  • Add --time/-t flag to set timer until specific time (e.g., 14:30, 2:30PM)
  • Support multiple time formats: 24h, 12h with AM/PM (case insensitive), with/without seconds
  • Implement smart scheduling: past times automatically target next day
  • Reject ambiguous single-digit hour formats (e.g., "1:30") to prevent confusion
  • Add calculateDurationUntilTime function with robust time parsing
  • Enhance formatDuration with cleaner display and better precision
  • Add comprehensive test suite with 95%+ coverage:
    • Duration formatting validation
    • Time parsing for all supported formats
    • Error handling and edge cases
    • Real-world usage scenarios
    • Performance benchmarks
  • Update README with usage examples and supported time formats
  • Maintain backward compatibility with existing duration-based timers

Examples: timer -t 14:30 # Until 2:30 PM today/tomorrow timer -t 2:30PM # 12-hour format timer -t 07:00 -n Alarm # Named morning timer

linkzera avatar May 23 '25 19:05 linkzera