Skip to main content
1

🕒 Relative Time

timeAgo()
String
Converts a past date into a human-readable “time ago” string (e.g., “2 months ago” or “Just now”).
final past = DateTime.now().subtract(const Duration(hours: 3));
print(past.timeAgo()); // "3 hours ago"
timeUntil()
String
Converts a future date into a human-readable “time until” string (e.g., “in 5 days” or “Just now”).
final future = DateTime.now().add(const Duration(hours: 5));
print(future.timeUntil()); // "in 5 hours"
slashedDate()
String
Formats the date into the slash-separated ‘dd/MM/yyyy’ style.
print(DateTime(2025, 12, 31).slashedDate()); // "31/12/2025"
2

🌐 Localization (`intl` dependency required)

monthName()
String
Gets the full name of the month (e.g., “January”, “December”) based on the system locale.
print(DateTime(2025, 12, 1).monthName()); // "December"
monthNameShort()
String
Gets the abbreviated name of the month (e.g., “Jan”, “Dec”) based on the system locale.
print(DateTime(2025, 12, 1).monthNameShort()); // "Dec"
dayName()
String
Gets the full name of the day of the week (e.g., “Monday”, “Sunday”) based on the system locale.
print(DateTime(2025, 12, 1).dayName()); // "Monday"
dayNameShort()
String
Gets the abbreviated name of the day of the week (e.g., “Mon”, “Sun”) based on the system locale.
print(DateTime(2025, 12, 1).dayNameShort()); // "Mon"
3

📊 Calendar Math

weekNumber()
int
Calculates the ISO 8601 week number (1-53) for the given date.
// January 1st is typically Week 1
print(DateTime(2025, 1, 1).weekNumber()); // 1