TimestampExtension extension

Extension methods on DateTime providing operator overloads and safe timestamp conversion.

final now = DateTime.now();
final later = now + Duration(hours: 1);
print(later > now); // true

final safeMs = now.safeMillisecondsSinceEpoch;
on

Properties

safeMillisecondsSinceEpoch int

Available on DateTime, provided by the TimestampExtension extension

Milliseconds since the Unix epoch, adjusted to avoid negative values.
no setter

Operators

operator +(Duration duration) DateTime

Available on DateTime, provided by the TimestampExtension extension

Returns a new DateTime offset by duration.
operator -(Duration duration) DateTime

Available on DateTime, provided by the TimestampExtension extension

Returns a new DateTime offset backward by duration.
operator <(DateTime other) bool

Available on DateTime, provided by the TimestampExtension extension

Whether this DateTime is strictly before other.
operator <=(DateTime other) bool

Available on DateTime, provided by the TimestampExtension extension

Whether this DateTime is at or before other.
operator >(DateTime other) bool

Available on DateTime, provided by the TimestampExtension extension

Whether this DateTime is strictly after other.
operator >=(DateTime other) bool

Available on DateTime, provided by the TimestampExtension extension

Whether this DateTime is at or after other.