time_plus 1.3.2
time_plus: ^1.3.2 copied to clipboard
Extensions for DateTime and Duration to easily add, convert, and work with time in Dart.
1.3.2 #
- Updated README
1.3.1 #
- Updated README
1.3.0 #
- Added full suite of
Duration→ fractional unit getters:asMilliseconds,asSeconds,asMinutes,asHours,asDays,asWeeks,asMonths,asYears,asDecades,asCenturies
- Added new
DateTimecalendar-aware getters:daysInMonth,daysInYear
- Added smart
Durationcreation fromintanddouble:1.days,2.hours,3.centuriesand1.5.hours,0.25.years,2.75.months, etc. Uses decomposition for precise accuracy.
- Updated month/year/decade/century logic for
Duration:- Now uses long-term Gregorian calendar averages:
- Month ≈ 30.436875 days
- Year ≈ 365.2425 days
- Decade ≈ 3,652.425 days
- Century ≈ 36,524.25 days
- Improves consistency, accuracy, and alignment with real-world time math
- Replaces prior approximations (
30,365,3650, etc.)
- Now uses long-term Gregorian calendar averages:
- Added
time vs time_pluscomparison section to README:- Highlights architectural improvements, precision gains, and test coverage
- Documents why
time_plusis a modern, high-performance alternative to thetimepackage
All new additions are documented in the README and covered by tests.
For exact calendar logic, continue usingDateTimemethods.
1.2.0 #
- Added comprehensive
DateTimesubtraction extensions with calendar-aware date arithmetic - Added
DateTimeSubtractMonthsAndYearsExtensionwithsubtractMonths,subtractYears,subtractMonth,subtractYearmethods - Added
DateTimeSubtractExtendingYearsExtensionwithsubtractDecades,subtractCenturies,subtractDecade,subtractCenturymethods - Works better than "adding minus days" or "adding minus weeks"
- Lowered Dart SDK constraint to
>=2.12.0 <4.0.0for wider compatibility
1.1.6 #
- Added
DateTimeNextExtensionsextension onDateTimeclass:- Advanced date navigation methods:
nextWeekdayTime: Find the next occurrence of a specific weekday with optional timenextTimeOfDay: Find the next time matching a specific time of day
- Advanced date navigation methods:
1.1.5 #
- Added
DateTimeWeekdayExtensionsextension onDateTimeclass:- Day navigation getters:
yesterday: Returns start of previous daytomorrow: Returns start of next day
- Weekday navigation getters:
nextWeekday: Returns weekday number of next daypreviousWeekday: Returns weekday number of previous day
- Day navigation getters:
1.1.4 #
Added detailed README for enhanced user experience.
Added #
- README with:
- Emoji-based Table of Contents
- Categorized DateTime and Duration extensions
- Code examples for features
- Emoji icons for readability
- "Back to Top" links
- Sections on:
- DateTime: Time units, precision, boundaries, leap year
- Duration: Time units, factory methods, conversion, breakdown, removal
- Examples with use cases, edge cases, chainable operations, calendar-aware calculations
- Support: License, support link, branding
1.1.3 #
Added comprehensive DateTime boundary functionality with extensive test coverage.
Added #
DateTimeBoundariesExtensionsextension onDateTimeclass:- New getters for precise temporal boundaries:
startOfMillisecond/endOfMillisecond: Microsecond-level boundariesstartOfSecond/endOfSecond: Millisecond-level boundariesstartOfMinute/endOfMinute: Second-level boundariesstartOfHour/endOfHour: Minute-level boundariesstartOfDay/endOfDay: Hour-level boundariesstartOfWeek/endOfWeek: Day-level boundaries (Monday-based)startOfMonth/endOfMonth: Day-level boundariesstartOfYear/endOfYear: Month-level boundariesstartOfDecade/endOfDecade: Year-level boundaries (10-year spans)startOfCentury/endOfCentury: Year-level boundaries (100-year spans)
- Smart handling of edge cases:
- Week transitions across month boundaries
- Month transitions with varying lengths
- Year transitions including leap years
- Decade and century transitions
- Timezone preservation
- Comprehensive test suite covering:
- All boundary types and transitions
- Leap year scenarios
- Month length variations
- Week boundary calculations
- Timezone consistency
- Microsecond precision
- Cross-century transitions
- New getters for precise temporal boundaries:
1.1.2 #
Added comprehensive temporal precision comparison functionality with extensive test coverage.
Added #
DateTimeIsSameExtensionsextension onDateTimeclass:- New methods for precise temporal comparison:
isSameCentury: Compare dates at century levelisSameDecade: Compare dates at decade levelisSameYear: Compare dates at year levelisSameMonth: Compare dates at month levelisSameDay: Compare dates at day levelisSameHour: Compare dates at hour levelisSameMinute: Compare dates at minute levelisSameSecond: Compare dates at second levelisSameMillisecond: Compare dates at millisecond levelisSameMicrosecond: Compare dates at microsecond level
- Smart handling of edge cases:
- Century transitions (e.g., 1999-2000)
- Decade boundaries
- Year boundaries
- Month transitions
- Day boundaries
- Leap year dates
- Comprehensive test suite covering:
- All precision levels
- Boundary conditions
- Leap year scenarios
- Time zone consistency
- Edge case handling
- New methods for precise temporal comparison:
1.1.1 #
Added comprehensive leap year functionality with extensive test coverage.
- New getters for leap year detection:
isLeapYear: Determines if a year is a leap year following the Gregorian calendar rulesisLeapMonth: Identifies February in leap yearsisLeapDay: Identifies February 29th in leap years
- Smart handling of edge cases:
- Years divisible by 4 but not by 100
- Years divisible by 100 but not by 400
- Years divisible by 400
- Invalid date combinations
- Comprehensive test suite
1.1.0 #
Comprehensive DateTime extensions for adding time units with proper handling of edge cases and calendar rules.
-
DateTimeAddDurationExtensionextension onDateTimeclass:- Methods for adding standard time units:
addMilliseconds: Add milliseconds with precise controladdSeconds: Add seconds with proper overflow handlingaddMinutes: Add minutes with automatic hour adjustmentaddHours: Add hours with automatic day adjustmentaddDays: Add days with proper month/year handlingaddWeeks: Add weeks using standard 7-day calculation
- Convenience getters for single unit additions:
addMillisecond: Add exactly one millisecondaddSecond: Add exactly one secondaddMinute: Add exactly one minuteaddHour: Add exactly one houraddDay: Add exactly one dayaddWeek: Add exactly one week
- Methods for adding standard time units:
-
DateTimeAddMonthsAndYearsExtensionextension onDateTimeclass:- Methods for calendar-aware additions:
addMonths: Add months with proper day clampingaddYears: Add years with leap year handling
- Convenience getters:
addMonth: Add exactly one monthaddYear: Add exactly one year
- Smart handling of edge cases:
- Month overflow (e.g., January 31 + 1 month)
- Leap year transitions
- Year boundaries
- Invalid date combinations
- Methods for calendar-aware additions:
-
DateTimeAddExtendingYearsExtensionextension onDateTimeclass:- Methods for long-term additions:
addDecades: Add decades with proper year calculationaddCenturies: Add centuries with proper decade calculation
- Convenience getters:
addDecade: Add exactly one decadeaddCentury: Add exactly one century
- Methods for long-term additions:
-
Added Comprehensive tests and detailed API documentation with examples, edge case handling, and best practices.
-
Refactored time constants into a unified
TimePlusConstsclass, removing the separateTimePlusDurationConstsfor better maintainability and consistency across the library.
1.0.0 #
Added duration remainder extraction functionality with comprehensive test coverage.
Added #
DurationWithoutExtensionsextension onDurationclass:- New getters for extracting remainders after removing complete time units:
withoutDays: Returns remainder after removing complete dayswithoutHours: Returns remainder after removing complete hourswithoutMinutes: Returns remainder after removing complete minuteswithoutSeconds: Returns remainder after removing complete secondswithoutMilliseconds: Returns remainder after removing complete milliseconds
- Efficient internal calculation method for remainder extraction
- Full support for both positive and negative durations
- Handles edge cases including:
- Zero durations
- Maximum/minimum duration values
- Mixed positive/negative components
- Very large duration values
- Boundary values
- Complex multi-unit combinations
- Comprehensive test suite for all remainder extraction methods and edge cases
- New getters for extracting remainders after removing complete time units:
0.0.4 #
Added comprehensive duration conversion getters for extended time units.
Added #
DurationInGettersExtensionsextension onDurationclass:- Integer-based getters for full time units:
fullWeeks: Get complete weeks (7 days each)fullMonths: Get complete months (30 days each)fullYears: Get complete years (365 days each)fullDecades: Get complete decades (3650 days each)fullCenturies: Get complete centuries (36500 days each)
- Double-based getters for precise time unit conversion:
asWeeks: Convert to weeks with decimal precisionasMonths: Convert to months with decimal precisionasYears: Convert to years with decimal precisionasDecades: Convert to decades with decimal precisionasCenturies: Convert to centuries with decimal precision
- Full support for both positive and negative durations
- Comprehensive test coverage for all conversion scenarios
- Integer-based getters for full time units:
0.0.3 #
Added duration unit extraction functionality with comprehensive test coverage.
Added #
DurationOnlyExtensionsextension onDurationclass:- New getters for extracting individual time units:
onlyMicroseconds: Extracts microseconds excluding full millisecondsonlyMilliseconds: Extracts milliseconds excluding full secondsonlySeconds: Extracts seconds excluding full minutesonlyMinutes: Extracts minutes excluding full hoursonlyHours: Extracts hours excluding full daysonlyDays: Extracts full days
- Efficient internal calculation method for unit extraction
- Full support for both positive and negative durations
- Comprehensive test suite for
DurationOnlyExtensions:
- New getters for extracting individual time units:
0.0.2 #
Added comprehensive test coverage and duration addition extensions.
Added #
DurationAddTimeExtensionsextension onDurationclass:- Methods for adding time units:
addMicroseconds,addMilliseconds,addSeconds,addMinutes,addHours,addDays,addWeeks,addMonths,addYears,addDecades,addCenturies - Convenience getters for single unit additions:
addMicrosecond,addMillisecond,addSecond,addMinute,addHour,addDay,addWeek,addMonth,addYear,addDecade,addCentury - Support for negative values and zero inputs
- Full composability with existing Duration operations
- Methods for adding time units:
Testing #
- Comprehensive test suite for all components:
- Unit tests for
TimePlusDurationConstsverifying all constant values - Extensive tests for
DurationFrommethods and constants - Complete test coverage for
DurationAddTimeExtensions
- Unit tests for
0.0.1 #
Initial release of time_plus package with core duration functionality.
Added #
-
TimePlusDurationConstsclass with essential time unit constants:- Basic time units: days in week (7), month (30), year (365)
- Extended time units: decade (10 years), century (100 years)
- Derived constants for days in decade and century
-
DurationFromutility class with comprehensive duration creation methods:- Factory methods for all time units from microseconds to centuries
- Constant duration instances for all time units
- Support for standard units (microseconds, milliseconds, seconds, minutes, hours, days)
- Support for extended units (weeks, months, years, decades, centuries)