time_plus
1.3.2, released a year ago by jozz.biz
Extensions for DateTime and Duration to easily add, convert, and work with time in Dart.
What it does
Adds comprehensive extension methods to DateTime and Duration for cleaner date math, rounding, boundaries, and conversions. It provides calendar-aware arithmetic for months and years, precise duration parsing from numbers, and comparisons down to the microsecond level.
AI-written summary of version 1.3.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to perform calendar-aware date arithmetic like adding months or years to a DateTime
- You want to convert and decompose Durations into specific units easily
- You want cleaner syntax for creating Durations using integers or doubles (e.g. 1.days)
Skip it when
- You need complex timezone management or localization formatting (use intl instead)
Strengths
- Zero dependencies
- Extensive coverage with over 100 extensions and hundreds of tests
- Calendar-aware handling of leap years and month/year boundaries
Weaknesses
- Relies entirely on standard Dart DateTime and Duration classes without a dedicated timezone engine
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
final now = DateTime(2024, 2, 29);
final nextYear = now.addYear;
final duration = 1.5.hours;Alternatives
Packages that do the same job and could replace time_plus.
- timezone
Time zone databases and time zone aware DateTime class in Dart.
94Compare - sugar
Standard library extension for date-times, timezones, collections, and monads.
68Compare - time
Type-safe DateTime and Duration calculations, powered by extensions.
70Compare - date_time
Provides Date, Time, and range classes with comparison and manipulation utilities.
49Compare