|
|
a1d87c40c0
|
feat(quando-5ib): implement date inspection methods
Implement comprehensive date inspection API for querying metadata:
Individual methods:
- WeekNumber() - ISO 8601 week numbers (1-53)
- Quarter() - Fiscal quarters (1-4)
- DayOfYear() - Julian day (1-366)
- IsWeekend() - Weekend detection (Sat/Sun)
- IsLeapYear() - Leap year detection (4/100/400 rule)
Aggregated method:
- Info() - Returns DateInfo struct with all metadata + Unix timestamp
Implementation details:
- Delegates to stdlib: WeekNumber uses time.ISOWeek(), DayOfYear uses time.YearDay()
- Zero allocations for all operations
- Performance: All methods < 60ns (far exceeds <1µs target)
- ISO 8601 compliant week numbers (Week 1 contains Thursday)
- Handles edge cases: year boundaries, week 53, century leap years
Testing:
- 83 comprehensive test cases covering all methods
- Edge cases: year boundaries, week 53, leap years, century rules
- 6 benchmarks (all <1µs, zero allocations)
- 8 example tests with clear documentation
- Coverage: 97.7%
Files:
- inspect.go: 145 lines (6 methods + DateInfo struct)
- inspect_test.go: 464 lines (tests + benchmarks)
- example_test.go: +124 lines (8 examples)
|
2026-02-11 20:45:53 +01:00 |
|