date_parts library
Calendar helpers for a day / month / year picker.
Dates are always handled as real calendar days. February 31 is shortened to the last valid day of that month instead of rolling into March.
Constants
-
monthAbbreviations
→ const List<
String> -
monthNames
→ const List<
String>
Functions
-
clampDate(
DateTime date, DateTime firstDate, DateTime lastDate) → DateTime -
clampDateParts(
{required int year, required int month, required int day, required DateTime firstDate, required DateTime lastDate}) → DateTime -
Builds a valid date inside
firstDateandlastDate. -
dateOnly(
DateTime date) → DateTime -
daysInMonth(
int year, int month) → int -
formatDdMmYyyy(
DateTime date, {String separator = '/'}) → String -
Formats a date as
09/10/2026. -
isLeapYear(
int year) → bool -
tryParseDdMmYyyy(
String text) → DateTime? -
Reads
09/10/2026. Returns null when the text is not a real calendar day.