DateTimeExtensions extension

on

Properties

dateYMD DateTime
no setter
formatted String
Gives formatted date in form of 'month - year'.
no setter
getTotalMinutes int
Returns total minutes this date is pointing at. if DateTime object is, DateTime(2021, 5, 13, 12, 4, 5) Then this getter will return 12*60 + 4 which evaluates to 724.
no setter
isDayStart bool
no setter
withoutTime DateTime
Returns DateTime without timestamp.
no setter

Methods

compareWithoutTime(DateTime date) bool
Compares only day, month and year of DateTime.
copyFromMinutes([int totalMinutes = 0]) DateTime
Returns a new DateTime object with hour and minutes calculated from totalMinutes.
datesOfMonths({WeekDays startDay = WeekDays.monday}) List<DateTime>
Returns list of all dates of month. All the dates are week based that means it will return array of size 42 which will contain 6 weeks that is the maximum number of weeks a month can have.
datesOfWeek({WeekDays start = WeekDays.monday}) List<DateTime>
Returns The List of date of Current Week, all of the dates will be without time. Day will start from Monday to Sunday.
firstDayOfWeek({WeekDays start = WeekDays.monday}) DateTime
Returns the first date of week containing the current date
getDayDifference(DateTime date) int
Gets difference of days between date and calling object.
getMonthDifference(DateTime date) int
Gets difference of months between date and calling object.
getWeekDifference(DateTime date, {WeekDays start = WeekDays.monday}) int
Gets difference of weeks between date and calling object.
hasSameTimeAs(DateTime other) bool
Compares time of two DateTime objects.
lastDayOfWeek({WeekDays start = WeekDays.monday}) DateTime
Returns the last date of week containing the current date