DateTimeExtensions extension

on

Properties

age int

Available on DateTime, provided by the DateTimeExtensions extension

Returns the age in years based on this date.
no setter
isToday bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if this date is today.
no setter
isWeekend bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if this date is Saturday or Sunday.
no setter

Methods

daysUntil(DateTime other) int

Available on DateTime, provided by the DateTimeExtensions extension

Number of days until another date.
isSameDay(DateTime other) bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if this date is the same day as other.
toFormattedDate({String pattern = 'yyyy-MM-dd', JBLocale? locale}) String

Available on DateTime, provided by the DateTimeExtensions extension

Format using a custom pattern (default 'yyyy-MM-dd')
toFullDateTime({JBLocale? locale}) String

Available on DateTime, provided by the DateTimeExtensions extension

Format: 'dd MMM ''yy, hh:mma' → Example: '15 Feb '25, 10:30AM'
toJBTimezone() DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Converts to the timezone offset defined in JBConfig.setTimezone
toRelativeTime() String

Available on DateTime, provided by the DateTimeExtensions extension

Relative string like 'Today', 'Yesterday', '2 days ago'
toShortDate({JBLocale? locale}) String

Available on DateTime, provided by the DateTimeExtensions extension

Format: 'MMM dd, yyyy' → Example: 'Feb 15, 2025'
toTime({JBLocale? locale}) String

Available on DateTime, provided by the DateTimeExtensions extension

Format: 'hh:mm a' → Example: '10:30 AM'