tempo_dart 0.1.1
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
intlconstraint from^0.19.0to^0.20.0. No API surface changes; all 390 tests pass againstintl 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 bymodifyanddiff.utils/locale_helper(internal):resolveLocale,isLocaleDataLoaded. Centralises BCP 47 locale resolution and a safeintldata-loaded probe.compare: extensionTempoCompareonDateTimeprovidingisSameOrBefore,isSameOrAfter,isSameDay,isSameMonth,isSameYear,isBetween,isToday,isYesterday,isTomorrow,isPast,isFuture,isThisWeek,isThisMonth,isThisYear,isLeapYear,isWeekend,isWeekday. All "uses now" methods accept an optionalclockcallback for deterministic testing.modify: extensionTempoModifyonDateTimeprovidingaddYears,addMonths,addWeeks,addDays,addHours,addMinutes,addSeconds,addMilliseconds,startOfDay,endOfDay,startOfWeek,endOfWeek,startOfMonth,endOfMonth,startOfYear,endOfYear.addMonths/addYearsclamp day-of-month per Moment.js / Tempo semantics; all methods preserve the receiver'sisUtcflag.diff: extensionTempoDiffonDateTimeprovidingdiffInMilliseconds,diffInSeconds,diffInMinutes,diffInHours,diffInDays,diffInWeeks,diffInMonths,diffInYears,diffAsDuration. EachdiffIn*acceptsabs: truefor an unsigned result. Calendar units use anniversary semantics; sub-unit residue truncates toward zero.format: top-levelformatDateplus extensionTempoFormat.formatonDateTime. 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 inkFormatStyles(short,medium,long,full,time,time24,datetime,iso,relative).relativecurrently throwsUnimplementedError.parse: top-levelparseDateandtryParseDateplus thekAutoPatternsentinel. Token table mirrorsformat. Auto-detect chain: ISO 8601 → RFC 2822 → locale skeletons (yMd,yMMMd,yMMMMd) → Unix timestamp.humanize: top-levelhumanizeDateplus extensionTempoHumanize.humanizeonDateTime.HumanizeOptions,HumanizeThresholds, andHumanizeUnitare exposed for configuration. Built-in locale strings coverenandfr; other locales fall back to English wording but use the locale's CLDR plural rules viaIntl.plural. Resolves spec open question §13.3 viaHumanizeOptions.nearFutureAsJustNow.duration_format: top-levelformatDurationplus extensionTempoDurationFormat.humanizeonDuration.DurationFormatOptionsandDurationUnitare exposed for configuration. Decomposes aDurationinto the units requested (largest-first), drops zero-valued segments unlessincludeZero: true, caps atmaxUnitssegments, and joins with the configuredseparator. Built-in unit labels coverenandfr; other locales fall back to English wording but use the locale's CLDR plural rules viaIntl.plural. Negative durations render with a leading-;Duration.zerofalls back to"0 <smallest-unit>"to avoid empty output. Unlikehumanize, count values of1stay 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 (
format↔parseround-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.mdfor the implementation roadmap.