DateTimeCalendarExtensions extension
Extensions on DateTime for age, calendar, formatting, and time alignment.
- on
Properties
- dayOfYear → int
-
Available on DateTime, provided by the DateTimeCalendarExtensions extension
Returns the day of the year (1-366).no setter - mostRecentSunday → DateTime
-
Available on DateTime, provided by the DateTimeCalendarExtensions extension
Returns the most recent Sunday before or on this date.no setter - toSerialString → String
-
Available on DateTime, provided by the DateTimeCalendarExtensions extension
Converts this DateTime to a serial string format (yyyyMMdd'T'HHmmss).no setter - toSerialStringDay → String
-
Available on DateTime, provided by the DateTimeCalendarExtensions extension
Converts this DateTime to a serial day string format (yyyyMMdd).no setter - weekOfYear → int
-
Available on DateTime, provided by the DateTimeCalendarExtensions extension
Returns a raw week-of-year value used internally.no setter
Methods
-
alignDateTime(
{required Duration alignment, bool shouldRoundUp = false}) → DateTime -
Available on DateTime, provided by the DateTimeCalendarExtensions extension
Returns a new DateTime aligned to the specifiedalignmentduration. -
calculateAgeFromDate(
DateTime fromDate) → int -
Available on DateTime, provided by the DateTimeCalendarExtensions extension
Calculates the age based on a given date. -
calculateAgeFromNow(
{DateTime? now}) → int -
Available on DateTime, provided by the DateTimeCalendarExtensions extension
Calculates the age based on the current date. -
getUtcTimeFromLocal(
double offset) → DateTime -
Available on DateTime, provided by the DateTimeCalendarExtensions extension
Converts this local DateTime to UTC using the given timezoneoffset. -
mostRecentWeekday(
int weekdayTarget) → DateTime -
Available on DateTime, provided by the DateTimeCalendarExtensions extension
Returns the most recent occurrence of the specified weekday. -
numOfWeeks(
int targetYear) → int -
Available on DateTime, provided by the DateTimeCalendarExtensions extension
Returns the number of ISO weeks in the specified year. -
setTime(
{required TimeOfDay time}) → DateTime -
Available on DateTime, provided by the DateTimeCalendarExtensions extension
Sets the time of the current DateTime to the specified TimeOfDay. -
weekNumber(
) → int -
Available on DateTime, provided by the DateTimeCalendarExtensions extension
Returns the ISO 8601 week number, correctly handling year boundaries.