DateTimeExtension extension

An extension on the DateTime class that provides a method for formatting the difference between a given date and the current date in human-readable format.

on

Methods

format(String format) String
Formats the DateTime object as a string based on the provided format.
isFuture() bool
Returns true if the DateTime object represents a date in the future.
isPast() bool
Returns true if the DateTime object represents a date in the past.
timeAgo({bool abbreviatedUnits = false, bool showRelativeDates = false, int precision = 2}) String
Returns a human-readable string representation of the difference between this date and the current date.