NyDateTime extension
Extensions for DateTime
- on
Methods
-
dd(
{String? tag}) → dynamic -
dump the value to the console and exit the app.
tag
is optional. -
dump(
{String? tag}) → dynamic -
dump the value to the console.
tag
is optional. -
hasExpired(
) → bool - Check if the date is still valid.
-
isAfternoon(
) → bool - Check if the date is in the afternoon.
-
isAgeBetween(
int min, int max) → bool? -
Check if DateTime is between a certain
min
andmax
age -
isAgeEqualTo(
int age) → dynamic -
Check if DateTime is equal to a certain
age
-
isAgeOlder(
int age) → bool? -
Check if DateTime is older than a certain
age
-
isAgeYounger(
int age) → bool? -
Check if DateTime is younger than a certain
age
-
isEvening(
) → bool - Check if the date is in the evening.
-
isInFuture(
) → bool - Check if DateTime is in the future
-
isInPast(
) → bool - Check if DateTime is in the past
-
isMorning(
) → bool - Check if the date is in the morning.
-
isNight(
) → bool - Check if the date is in the night.
-
isSameDay(
DateTime dateTimeToCompare) → bool -
Check if a date is the same day as another date.
dateTime1
anddateTime2
are the dates to compare. -
isToday(
) → bool - Check if DateTime is today
-
isTomorrow(
) → bool - Check if DateTime is tomorrow
-
isYesterday(
) → bool - Check if DateTime is yesterday
-
toAge(
) → int? - Format DateTime to an age
-
toDateString(
) → String? - Format DateTime to toDateString - yyyy-MM-dd
-
toDateTimeString(
) → String? - Format DateTime to DateTimeString - yyyy-MM-dd HH:mm:ss
-
toFormat(
String format) → String? - Format DateTime
-
toShortDate(
) → String - Format DateTime to a short date - example "Mon 1st Jan"
-
toTimeAgoString(
) → String? -
toTimeString(
{bool withSeconds = false}) → String? - Format DateTime to toTimeString - HH:mm or HH:mm:ss