calendar_date 0.9.1 copy "calendar_date: ^0.9.1" to clipboard
calendar_date: ^0.9.1 copied to clipboard

A Dart package for managing timezone-agnostic calendar dates.

calendar_date #

calendar_date is a dart package for creating timezone-agnostic Dates and DateTimes.

License #

This project is licensed under the MIT License.

Features #

  • Immutable CalendarDate and CalendarDateTime classes
  • Easy date arithmetic (add, subtract, difference)
  • Date range iteration and stride utilities
  • Comparison operators and equality
  • Utilities for working with months, weeks, and days

Installation #

Add the following to your pubspec.yaml:

dependencies:
	calendar_date: ^<latest_version>

Then run:

dart pub get

Usage #

Import the package:

import 'package:calendar_date/calendar_date.dart';

Creating Dates #

final date = CalendarDate(2025, 8, 4);
final today = CalendarDate.local();
final todayUtc = CalendarDate.zulu();
final today2 = CalendarDate.fromDateTime(DateTime.now());
final today2Utc = CalendarDate.fromDateTime(DateTime.timestamp());

Date Arithmetic #

final tomorrow = date + const Duration(days: 1); 
final yesterday = date - const Duration(days: 1);

Date Ranges and Stride #

for (final d in date.to(tomorrow, by: const Duration(days: 1))) {
	print(d);
}
OUT:
2025-08-04
2025-08-05

Comparison #

if (date > CalendarDate(2025, 1, 1)) {
	print('Date is after Jan 1, 2025');
}

Contributing #

Contributions are welcome! Please open issues or submit pull requests on GitHub.

  1. Fork the repository
  2. Create a feature branch
  3. Write tests for your changes
  4. Open a pull request
0
likes
140
points
62
downloads

Documentation

API reference

Publisher

verified publisherpryor.io

Weekly Downloads

A Dart package for managing timezone-agnostic calendar dates.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

strider

More

Packages that depend on calendar_date