tempo 1.0.0
tempo: ^1.0.0 copied to clipboard
A complete time and date solution that replaces Dart's core DateTime with a rich set of date and time classes, advanced arithmetic features and full time zone support.
Changelog #
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.0.0 - 2026-01-03 #
Added #
- New matchers for
HasInstantclasses that match the Unix timestamp:hasUnixSecondshasUnixMilliseecondshasUnixMicrosecondshasUnixNanosecondshasDateAndTime
- Added
format()methods that take aDateFormatfrom the intl package and return a string. - All date and datetime objects have an
inLeapYearproperty. replace()methods onOffsetDateTimeandZonedDateTimethat replace individual fields in the object.
Changed #
- Made some constructors
const:Timespan()Instant.fromUnix()ZoneOffset()LocalDate()LocalTime()LocalDateTime()OffsetDateTime.withOffset()
- All
minimumandmaximumdate time values areconstinstead offinal. - Using
clockpackage for allnow()constructors. - Improved failure output of
hasDateandhasTime - Constructors no longer throw exceptions when given an invalid date, but they
do guarantee a valid, albeit unspecified, result. (Other than
ZonedDateTime, which will still throw for invalid zone ids.)
Deprecated #
LocalDate.isLeapYear: UseinLeapYearinstead.
Removed #
- Breaking:
ZoneOffset.local()removed. Useoffseton aZonedDateTimeinstead. For example:ZonedDateTime.now().offset.
Fixed #
ZoneOffsetequals and hash code methods now correctly include thesecondscomponent.OffsetDateTime.now()now matches its documentation by returning times and offsets indefaultZoneId.
0.7.0 - 2025-08-02 #
Added #
- Missing conversion methods, and standardized the existing ones (see the library docs for a list of conversion method names)
- New ISO 8601
parse()constructors forInstantandZonedDateTime - Parses ISO date times with either a space or no separator instead of a 'T'
Changed #
- Breaking:
ZonedDateTime.defaultZoneIdmoved to a top-level getter/setter pair - Setting
defaultZoneIdto an invalid value now throws an exception - Breaking:
ZonedDateTime.toOffset()changed to a getter,asOffsetDateTime - Breaking:
toDateTime()no longer a part of theHasDateinterface - Breaking:
HasInstantnow usestoInstant()method instead ofasInstantgetter - Breaking:
OffsetDateTimenow defaults todefaultZoneIdinstead of UTC:- Removed
offsetarg from the unnamed constructor. UsewithOffsetconstructor instead - All other
offsetconstructor and conversion method args are now optional and default to the time zone indefaultZoneId - One exception: the
fromDateTimeconstructor continues to use the offset from theDateTimeit's given
- Removed
Removed #
- Breaking: All
asInstantgetters removed. UsetoInstant()instead.
Fixed #
- Breaking: DateTime extension method
toLocal()renamed totoLocalDateTime()so it doesn't shadow an existing method - Test matchers
hasDateandhasTimeno longer ignore unspecified fields, and instead check for expected defaults. For example,expect(LocalTime(4, 30), hasTime(4))used to pass. Now it fails, since the unspecified minute matcher defaults to 0.
0.6.0 - 2025-06-11 #
Added #
- Added
usandisogetters to Weekday for weekday numbers - Added extension methods on DateTime and Duration to convert to Tempo objects
Changed #
- Minimum Dart SDK is now 3.0.0
- Made zoneId optional for ZonedDateTime creation. This is seamless with one exception (see below)
- Breaking: Removed zoneId arg from ZonedDateTime(). Use ZonedDateTime.withZoneId() if you want to specify a time zone.
- ZonedDateTime now has a settable defaultZoneId field that will be used if none is provided.
- Improved documentation; assigned objects to categories and created category documentation pages.