Documentation Index
Fetch the complete documentation index at: https://starrycodes.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
ποΈ Simple Duration
The number of days to add to the current date.
Adds a number of days to the current DateTime object.final futureDate = DateTime.now().addDays(5);
The number of days to subtract from the current date.
Subtracts a number of days from the current DateTime object.final pastDate = DateTime.now().subtractDays(10);
π
Calendar Components (Use with Caution)
Be cautious with addMonths and addYears. Dartβs DateTime constructor handles invalid days (like Feb 30th) by overflowing to the next month/year. Always test edge cases (e.g., Jan 31st + 1 month = Mar 3rd).
The number of months to add to the current date.
Adds a number of months. (Warning: Susceptible to date overflow errors.)// Goes from March 15th to June 15th
final newDate = DateTime(2025, 3, 15).addMonths(3);
subtractMonths(int months)
The number of months to subtract from the current date.
Subtracts a number of months. (Warning: Susceptible to date overflow errors.)// Goes from May 20th to February 20th
final pastDate = DateTime(2025, 5, 20).subtractMonths(3);
The number of years to add to the current date.
Adds a number of years. (Warning: Be mindful of leap years.)final futureYear = DateTime.now().addYears(5);
The number of years to subtract from the current date.
Subtracts a number of years. (Warning: Be mindful of leap years.)final pastYear = DateTime.now().subtractYears(2);
πΌ Business Days
addBusinessDays(int days)
The number of business days to add.
Adds a number of business days (Monday to Friday) to the current date, automatically skipping weekends.// If today is Friday, adding 1 business day results in Monday.
final nextWorkDay = DateTime(2025, 11, 28).addBusinessDays(1);