NyDateTime extension

Extensions for DateTime

on

Methods

dd({String? tag}) → dynamic

Available on DateTime?, provided by the NyDateTime extension

dump the value to the console and exit the app. tag is optional.
dump({String? tag}) → dynamic

Available on DateTime?, provided by the NyDateTime extension

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

Available on DateTime?, provided by the NyDateTime extension

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

Available on DateTime?, provided by the NyDateTime extension

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

Available on DateTime?, provided by the NyDateTime extension

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

Available on DateTime?, provided by the NyDateTime extension

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

Available on DateTime?, provided by the NyDateTime extension

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

Available on DateTime?, provided by the NyDateTime extension

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

Available on DateTime?, provided by the NyDateTime extension

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

Available on DateTime?, provided by the NyDateTime extension

Check if DateTime is in the future
isInPast() bool

Available on DateTime?, provided by the NyDateTime extension

Check if DateTime is in the past
isMorning() bool

Available on DateTime?, provided by the NyDateTime extension

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

Available on DateTime?, provided by the NyDateTime extension

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

Available on DateTime?, provided by the NyDateTime 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 NyDateTime extension

Check if DateTime is today
isTomorrow() bool

Available on DateTime?, provided by the NyDateTime extension

Check if DateTime is tomorrow
isYesterday() bool

Available on DateTime?, provided by the NyDateTime extension

Check if DateTime is yesterday
toAge() int?

Available on DateTime?, provided by the NyDateTime extension

Format DateTime to an age
toDateString() String?

Available on DateTime?, provided by the NyDateTime extension

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

Available on DateTime?, provided by the NyDateTime extension

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

Available on DateTime?, provided by the NyDateTime extension

Format DateTime
toShortDate() String

Available on DateTime?, provided by the NyDateTime extension

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

Available on DateTime?, provided by the NyDateTime extension

toTimeString({bool withSeconds = false}) String?

Available on DateTime?, provided by the NyDateTime extension

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