NyDateTimeExt extension

Extensions for DateTime

on

Methods

addDays(int days) → DateTime

Available on DateTime?, provided by the NyDateTimeExt extension

Add days to a DateTime
addHours(int hours) → DateTime

Available on DateTime?, provided by the NyDateTimeExt extension

Add hours to a DateTime
addMinutes(int minutes) → DateTime

Available on DateTime?, provided by the NyDateTimeExt extension

addMonths(int months) → DateTime

Available on DateTime?, provided by the NyDateTimeExt extension

Add months to a DateTime
addSeconds(int seconds) → DateTime

Available on DateTime?, provided by the NyDateTimeExt extension

Add seconds to a DateTime
addYears(int years) → DateTime

Available on DateTime?, provided by the NyDateTimeExt extension

Add years to a DateTime
dd({String? tag}) → void

Available on DateTime?, provided by the NyDateTimeExt extension

dump the value to the console and exit the app. tag is optional. On web the exit step is skipped (dart:io's exit() is unavailable).
dump({String? tag}) → void

Available on DateTime?, provided by the NyDateTimeExt extension

dump the value to the console. tag is optional.
hasExpired() → bool

Available on DateTime?, provided by the NyDateTimeExt extension

Check if the date is still valid.
isAfternoon() → bool

Available on DateTime?, provided by the NyDateTimeExt extension

Check if the date is in the afternoon.
isAgeBetween(int min, int max) → bool?

Available on DateTime?, provided by the NyDateTimeExt extension

Check if DateTime is between a certain min and max age
isAgeEqualTo(int age) → bool?

Available on DateTime?, provided by the NyDateTimeExt extension

Check if DateTime is equal to a certain age
isAgeOlder(int age) → bool?

Available on DateTime?, provided by the NyDateTimeExt extension

Check if DateTime is older than a certain age
isAgeYounger(int age) → bool?

Available on DateTime?, provided by the NyDateTimeExt extension

Check if DateTime is younger than a certain age
isEvening() → bool

Available on DateTime?, provided by the NyDateTimeExt extension

Check if the date is in the evening.
isInFuture() → bool

Available on DateTime?, provided by the NyDateTimeExt extension

Check if DateTime is in the future
isInPast() → bool

Available on DateTime?, provided by the NyDateTimeExt extension

Check if DateTime is in the past
isMorning() → bool

Available on DateTime?, provided by the NyDateTimeExt extension

Check if the date is in the morning.
isNight() → bool

Available on DateTime?, provided by the NyDateTimeExt extension

Check if the date is in the night.
isSameDay(DateTime dateTimeToCompare) → bool

Available on DateTime?, provided by the NyDateTimeExt extension

Check if a date is the same day as another date. dateTime1 and dateTime2 are the dates to compare.
isToday() → bool

Available on DateTime?, provided by the NyDateTimeExt extension

Check if DateTime is today
isTomorrow() → bool

Available on DateTime?, provided by the NyDateTimeExt extension

Check if DateTime is tomorrow
isYesterday() → bool

Available on DateTime?, provided by the NyDateTimeExt extension

Check if DateTime is yesterday
subtractDays(int days) → DateTime

Available on DateTime?, provided by the NyDateTimeExt extension

Subtract days from a DateTime
subtractHours(int hours) → DateTime

Available on DateTime?, provided by the NyDateTimeExt extension

Subtract hours from a DateTime
subtractMinutes(int minutes) → DateTime

Available on DateTime?, provided by the NyDateTimeExt extension

Subtract minutes from a DateTime
subtractMonths(int months) → DateTime

Available on DateTime?, provided by the NyDateTimeExt extension

Subtract months from a DateTime
subtractSeconds(int seconds) → DateTime

Available on DateTime?, provided by the NyDateTimeExt extension

Subtract seconds from a DateTime
subtractYears(int years) → DateTime

Available on DateTime?, provided by the NyDateTimeExt extension

Subtract years from a DateTime
toAge() → int?

Available on DateTime?, provided by the NyDateTimeExt extension

Format DateTime to an age
toDateString({String format = "yyyy-MM-dd"}) → String?

Available on DateTime?, provided by the NyDateTimeExt extension

Format DateTime to toDateString - yyyy-MM-dd
toDateStringUK({String format = "dd/MM/yyyy"}) → String?

Available on DateTime?, provided by the NyDateTimeExt extension

Format DateTime to toDateString - yyyy-MM-dd
toDateStringUS({String format = "MM/dd/yyyy"}) → String?

Available on DateTime?, provided by the NyDateTimeExt extension

Format DateTime to toDateString - yyyy-MM-dd
toDateTimeString() → String?

Available on DateTime?, provided by the NyDateTimeExt extension

Format DateTime to DateTimeString - yyyy-MM-dd HH:mm:ss
toFormat(String format) → String?

Available on DateTime?, provided by the NyDateTimeExt extension

Format DateTime
toShortDate() → String

Available on DateTime?, provided by the NyDateTimeExt extension

Format DateTime to a short date - example "Mon 1st Jan"
toTimeAgoString() → String?

Available on DateTime?, provided by the NyDateTimeExt extension

toTimestamp() → String?

Available on DateTime?, provided by the NyDateTimeExt extension

Format DateTime to Unix timestamp
toTimeString({bool withSeconds = false}) → String?

Available on DateTime?, provided by the NyDateTimeExt extension

Format DateTime to toTimeString - HH:mm or HH:mm:ss