tempo 1.0.0 copy "tempo: ^1.0.0" to clipboard
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 HasInstant classes that match the Unix timestamp:
    • hasUnixSeconds
    • hasUnixMilliseeconds
    • hasUnixMicroseconds
    • hasUnixNanoseconds
    • hasDateAndTime
  • Added format() methods that take a DateFormat from the intl package and return a string.
  • All date and datetime objects have an inLeapYear property.
  • replace() methods on OffsetDateTime and ZonedDateTime that replace individual fields in the object.

Changed #

  • Made some constructors const:
    • Timespan()
    • Instant.fromUnix()
    • ZoneOffset()
    • LocalDate()
    • LocalTime()
    • LocalDateTime()
    • OffsetDateTime.withOffset()
  • All minimum and maximum date time values are const instead of final.
  • Using clock package for all now() constructors.
  • Improved failure output of hasDate and hasTime
  • 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: Use inLeapYear instead.

Removed #

  • Breaking: ZoneOffset.local() removed. Use offset on a ZonedDateTime instead. For example: ZonedDateTime.now().offset.

Fixed #

  • ZoneOffset equals and hash code methods now correctly include the seconds component.
  • OffsetDateTime.now() now matches its documentation by returning times and offsets in defaultZoneId.

0.7.1 - 2025-12-10 #

Changed #

  • Updated to timezone database version 2025c

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 for Instant and ZonedDateTime
  • Parses ISO date times with either a space or no separator instead of a 'T'

Changed #

  • Breaking: ZonedDateTime.defaultZoneId moved to a top-level getter/setter pair
  • Setting defaultZoneId to an invalid value now throws an exception
  • Breaking: ZonedDateTime.toOffset() changed to a getter, asOffsetDateTime
  • Breaking: toDateTime() no longer a part of the HasDate interface
  • Breaking: HasInstant now uses toInstant() method instead of asInstant getter
  • Breaking: OffsetDateTime now defaults to defaultZoneId instead of UTC:
    • Removed offset arg from the unnamed constructor. Use withOffset constructor instead
    • All other offset constructor and conversion method args are now optional and default to the time zone in defaultZoneId
    • One exception: the fromDateTime constructor continues to use the offset from the DateTime it's given

Removed #

  • Breaking: All asInstant getters removed. Use toInstant() instead.

Fixed #

  • Breaking: DateTime extension method toLocal() renamed to toLocalDateTime() so it doesn't shadow an existing method
  • Test matchers hasDate and hasTime no 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 us and iso getters 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.

0.5.4 - 2025-05-22 #

Changed #

  • Updated to tzdb-2025b
  • Minimum Dart SDK is now 2.19.0

0.5.3 - 2024-08-03 #

Changed #

  • Updated to tzdb-2024a.

0.5.2 - 2023-05-26 #

Added #

  • Added unixTimestamp and inTimezone() to HasInstant interface.

0.5.1 - 2023-05-21 #

Changed #

  • Fixed broken links in README.md

0.5.0 - 2023-05-21 #

Added #

  • Initial version.
6
likes
160
points
310
downloads

Publisher

verified publisherniladic.org

Weekly Downloads

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.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

built_collection, built_value, clock, collection, intl, meta, string_scanner, test

More

Packages that depend on tempo