SmartDateExtension extension

Smart DateTime extensions

on

Properties

age int

Available on DateTime, provided by the SmartDateExtension extension

Age in years from this date to today
no setter
calendar String

Available on DateTime, provided by the SmartDateExtension extension

Returns calendar string
no setter
dayOfYear int

Available on DateTime, provided by the SmartDateExtension extension

Day number of the year (1–366)
no setter
endOfDay DateTime

Available on DateTime, provided by the SmartDateExtension extension

End of the day — 2024-06-15 23:59:59
no setter
endOfMonth DateTime

Available on DateTime, provided by the SmartDateExtension extension

End of the month — last day 23:59:59
no setter
endOfWeek DateTime

Available on DateTime, provided by the SmartDateExtension extension

End of the week — Sunday 23:59:59
no setter
endOfYear DateTime

Available on DateTime, provided by the SmartDateExtension extension

End of the year — Dec 31 23:59:59
no setter
isAfternoon bool

Available on DateTime, provided by the SmartDateExtension extension

Whether time is afternoon (12PM–5PM)
no setter
isEvening bool

Available on DateTime, provided by the SmartDateExtension extension

Whether time is evening (5PM–9PM)
no setter
isFuture bool

Available on DateTime, provided by the SmartDateExtension extension

Whether this date is in the future
no setter
isLeapYear bool

Available on DateTime, provided by the SmartDateExtension extension

Whether this year is a leap year
no setter
isMorning bool

Available on DateTime, provided by the SmartDateExtension extension

Whether time is morning (6AM–12PM)
no setter
isNight bool

Available on DateTime, provided by the SmartDateExtension extension

Whether time is night (9PM–6AM)
no setter
isPast bool

Available on DateTime, provided by the SmartDateExtension extension

Whether this date is in the past
no setter
isQ1 bool

Available on DateTime, provided by the SmartDateExtension extension

Whether this date is in Q1 (Jan–Mar)
no setter
isQ2 bool

Available on DateTime, provided by the SmartDateExtension extension

Whether this date is in Q2 (Apr–Jun)
no setter
isQ3 bool

Available on DateTime, provided by the SmartDateExtension extension

Whether this date is in Q3 (Jul–Sep)
no setter
isQ4 bool

Available on DateTime, provided by the SmartDateExtension extension

Whether this date is in Q4 (Oct–Dec)
no setter
isToday bool

Available on DateTime, provided by the SmartDateExtension extension

Whether this date is today
no setter
isTomorrow bool

Available on DateTime, provided by the SmartDateExtension extension

Whether this date is tomorrow
no setter
isWeekday bool

Available on DateTime, provided by the SmartDateExtension extension

Whether this date is a weekday (Monday–Friday)
no setter
isWeekend bool

Available on DateTime, provided by the SmartDateExtension extension

Whether this date is a weekend (Saturday or Sunday)
no setter
isYesterday bool

Available on DateTime, provided by the SmartDateExtension extension

Whether this date was yesterday
no setter
nextFriday DateTime

Available on DateTime, provided by the SmartDateExtension extension

Next Friday from this date
no setter
nextMonday DateTime

Available on DateTime, provided by the SmartDateExtension extension

Next Monday from this date
no setter
nextSaturday DateTime

Available on DateTime, provided by the SmartDateExtension extension

Next Saturday from this date
no setter
nextSunday DateTime

Available on DateTime, provided by the SmartDateExtension extension

Next Sunday from this date
no setter
nextThursday DateTime

Available on DateTime, provided by the SmartDateExtension extension

Next Thursday from this date
no setter
nextTuesday DateTime

Available on DateTime, provided by the SmartDateExtension extension

Next Tuesday from this date
no setter
nextWednesday DateTime

Available on DateTime, provided by the SmartDateExtension extension

Next Wednesday from this date
no setter
previousFriday DateTime

Available on DateTime, provided by the SmartDateExtension extension

Previous Friday from this date
no setter
previousMonday DateTime

Available on DateTime, provided by the SmartDateExtension extension

Previous Monday from this date
no setter
previousSaturday DateTime

Available on DateTime, provided by the SmartDateExtension extension

Previous Saturday from this date
no setter
previousSunday DateTime

Available on DateTime, provided by the SmartDateExtension extension

Previous Sunday from this date
no setter
previousThursday DateTime

Available on DateTime, provided by the SmartDateExtension extension

Previous Thursday from this date
no setter
previousTuesday DateTime

Available on DateTime, provided by the SmartDateExtension extension

Previous Tuesday from this date
no setter
previousWednesday DateTime

Available on DateTime, provided by the SmartDateExtension extension

Previous Wednesday from this date
no setter
quarter int

Available on DateTime, provided by the SmartDateExtension extension

Quarter of the year (1–4)
no setter
shortTimestamp String

Available on DateTime, provided by the SmartDateExtension extension

Returns short timestamp
no setter
startOfDay DateTime

Available on DateTime, provided by the SmartDateExtension extension

Start of the day — 2024-06-15 00:00:00
no setter
startOfMonth DateTime

Available on DateTime, provided by the SmartDateExtension extension

Start of the month — 1st 00:00:00
no setter
startOfWeek DateTime

Available on DateTime, provided by the SmartDateExtension extension

Start of the week — Monday 00:00:00
no setter
startOfYear DateTime

Available on DateTime, provided by the SmartDateExtension extension

Start of the year — Jan 1 00:00:00
no setter
timeAgo String

Available on DateTime, provided by the SmartDateExtension extension

Returns relative time string
no setter
to12Hour String

Available on DateTime, provided by the SmartDateExtension extension

Returns 12-hour format — "02:30 PM"
no setter
to24Hour String

Available on DateTime, provided by the SmartDateExtension extension

Returns 24-hour format — "14:30"
no setter
toISO String

Available on DateTime, provided by the SmartDateExtension extension

Returns ISO 8601 without milliseconds — "2024-06-15T14:30:00"
no setter
toReadable String

Available on DateTime, provided by the SmartDateExtension extension

Returns "Saturday, 15 June 2024"
no setter
toTimeString String

Available on DateTime, provided by the SmartDateExtension extension

Returns 24-hour time string — "14:30:00"
no setter
weekOfYear int

Available on DateTime, provided by the SmartDateExtension extension

Week number of the year (1–53)
no setter

Methods

addWorkingDays(int days) DateTime

Available on DateTime, provided by the SmartDateExtension extension

Adds days working days — skips weekends
copyWith({int? year, int? month, int? day, int? hour, int? minute, int? second, int? millisecond}) DateTime

Available on DateTime, provided by the SmartDateExtension extension

Returns a copy of this DateTime with given fields replaced
daysSince(DateTime other) int

Available on DateTime, provided by the SmartDateExtension extension

Days since other date
daysUntil(DateTime other) int

Available on DateTime, provided by the SmartDateExtension extension

Days until other date — positive if future, negative if past
format(String pattern) String

Available on DateTime, provided by the SmartDateExtension extension

Format date using custom pattern
isBetween(DateTime start, DateTime end) bool

Available on DateTime, provided by the SmartDateExtension extension

Whether this date falls between start and end (inclusive)
isSameDay(DateTime other) bool

Available on DateTime, provided by the SmartDateExtension extension

Whether this date is the same day as other
isSameMonth(DateTime other) bool

Available on DateTime, provided by the SmartDateExtension extension

Whether this date is in the same month as other
isSameWeek(DateTime other) bool

Available on DateTime, provided by the SmartDateExtension extension

Whether this date is in the same week as other
isSameYear(DateTime other) bool

Available on DateTime, provided by the SmartDateExtension extension

Whether this date is in the same year as other
timeAgoIn(SdfLocale locale) String

Available on DateTime, provided by the SmartDateExtension extension

Returns relative time in given locale
workingDaysUntil(DateTime other) int

Available on DateTime, provided by the SmartDateExtension extension

Number of working days between this and other