DateTimeExtension extension

An extension on the DateTime class that provides methods for formatting and comparing dates in human-readable formats.

on

Methods

format(String format) String

Available on DateTime, provided by the DateTimeExtension extension

Formats the DateTime object as a string based on the provided format.
isFuture() bool

Available on DateTime, provided by the DateTimeExtension extension

Checks if the DateTime object represents a date in the future.
isPast() bool

Available on DateTime, provided by the DateTimeExtension extension

Checks if the DateTime object represents a date in the past.
timeAgo({bool abbreviatedUnits = false, bool showRelativeDates = false, int precision = 2}) String

Available on DateTime, provided by the DateTimeExtension extension

Returns a human-readable string representation of the difference between this date and the current date.