tempo_dart 0.1.1 copy "tempo_dart: ^0.1.1" to clipboard
tempo_dart: ^0.1.1 copied to clipboard

A lightweight, tree-shakable date and time utility library for Dart and Flutter, built around native DateTime.

0.1.1 #

Changed #

  • Bump intl constraint from ^0.19.0 to ^0.20.0. No API surface changes; all 390 tests pass against intl 0.20.2. Resolves the "outdated dependencies" deduction on pub.dev.

0.1.0 #

Added #

  • utils/overflow_guard (internal): isLeapYear, daysInMonth, clampedDate. Building blocks for month-overflow handling shared by modify and diff.
  • utils/locale_helper (internal): resolveLocale, isLocaleDataLoaded. Centralises BCP 47 locale resolution and a safe intl data-loaded probe.
  • compare: extension TempoCompare on DateTime providing isSameOrBefore, isSameOrAfter, isSameDay, isSameMonth, isSameYear, isBetween, isToday, isYesterday, isTomorrow, isPast, isFuture, isThisWeek, isThisMonth, isThisYear, isLeapYear, isWeekend, isWeekday. All "uses now" methods accept an optional clock callback for deterministic testing.
  • modify: extension TempoModify on DateTime providing addYears, addMonths, addWeeks, addDays, addHours, addMinutes, addSeconds, addMilliseconds, startOfDay, endOfDay, startOfWeek, endOfWeek, startOfMonth, endOfMonth, startOfYear, endOfYear. addMonths/addYears clamp day-of-month per Moment.js / Tempo semantics; all methods preserve the receiver's isUtc flag.
  • diff: extension TempoDiff on DateTime providing diffInMilliseconds, diffInSeconds, diffInMinutes, diffInHours, diffInDays, diffInWeeks, diffInMonths, diffInYears, diffAsDuration. Each diffIn* accepts abs: true for an unsigned result. Calendar units use anniversary semantics; sub-unit residue truncates toward zero.
  • format: top-level formatDate plus extension TempoFormat.format on DateTime. Supports the full 18-token table (YYYY/YY/MMMM/MMM/ MM/M/DD/D/dddd/ddd/HH/H/hh/h/mm/ss/SSS/A/ a/Z/x) with [literal] blocks and the style shorthands declared in kFormatStyles (short, medium, long, full, time, time24, datetime, iso, relative). relative currently throws UnimplementedError.
  • parse: top-level parseDate and tryParseDate plus the kAutoPattern sentinel. Token table mirrors format. Auto-detect chain: ISO 8601 → RFC 2822 → locale skeletons (yMd, yMMMd, yMMMMd) → Unix timestamp.
  • humanize: top-level humanizeDate plus extension TempoHumanize.humanize on DateTime. HumanizeOptions, HumanizeThresholds, and HumanizeUnit are exposed for configuration. Built-in locale strings cover en and fr; other locales fall back to English wording but use the locale's CLDR plural rules via Intl.plural. Resolves spec open question §13.3 via HumanizeOptions.nearFutureAsJustNow.
  • duration_format: top-level formatDuration plus extension TempoDurationFormat.humanize on Duration. DurationFormatOptions and DurationUnit are exposed for configuration. Decomposes a Duration into the units requested (largest-first), drops zero-valued segments unless includeZero: true, caps at maxUnits segments, and joins with the configured separator. Built-in unit labels cover en and fr; other locales fall back to English wording but use the locale's CLDR plural rules via Intl.plural. Negative durations render with a leading -; Duration.zero falls back to "0 <smallest-unit>" to avoid empty output. Unlike humanize, count values of 1 stay literal ("1 hour", never "an hour") — see the module doc-comment for the rationale.
  • 390-test suite covering every implemented module, including cross-module integration (formatparse round-trips, modify + compare, modify + humanize, diff + compare, diff + duration_format).

0.1.0-dev (initial scaffold) #

  • Initial scaffold. Public API surface defined; module bodies stubbed pending implementation. See DESIGN.md for the implementation roadmap.
0
likes
160
points
--
downloads

Documentation

API reference

Publisher

verified publishershop.stripedape.tech

A lightweight, tree-shakable date and time utility library for Dart and Flutter, built around native DateTime.

Repository (GitHub)
View/report issues

Topics

#date #time #datetime #intl #formatting

License

MIT (license)

Dependencies

intl, meta

More

Packages that depend on tempo_dart