DateTimeExtensions extension

Useful extensions on DateTime for date checks and human-readable formatting.

on

Properties

isToday → bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if this date is today.
no setter
isTomorrow → bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if this date is tomorrow.
no setter
isYesterday → bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if this date was yesterday.
no setter
timeAgo → String

Available on DateTime, provided by the DateTimeExtensions extension

Returns a human-readable relative time string (e.g. "Just now", "5m ago", "2h ago", "Yesterday").
no setter
toDateString → String

Available on DateTime, provided by the DateTimeExtensions extension

Formats date to YYYY-MM-DD string.
no setter
toTimeString → String

Available on DateTime, provided by the DateTimeExtensions extension

Formats time to HH:MM:SS string.
no setter

Methods

isSameDay(DateTime other) → bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if this date falls on the exact same day as other.