date_and_time
0.0.5-alpha, released 2 years ago by christianfindlay.com
Provides clean, immutable Date and Time types separately from DateTime.
WASM-ready
What it does
It separates date and time concepts to simplify code, make comparisons easier, and avoid DateTime complexity. It includes string parsing, date arithmetic, timezone support, and zone-based time control for testing.
AI-written summary of version 0.0.5-alpha, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to handle calendar dates or time-of-day values independently without DateTime complexity.
- You need robust, flaky-free testing capabilities by mocking dates and times.
- You want a UTC-first approach for date and time operations.
Skip it when
- You heavily rely on native combined Date and Time operations with automatic localized offset logic.
- You are using a stable production release and want to avoid alpha-stage packages.
Strengths
- Clean and immutable types for `Date` and `Time`.
- Built-in zone-based time mocking support for tests.
- Intuitive API design with UTC-first operations.
Weaknesses
- Currently in alpha stage (version 0.0.5-alpha), meaning APIs may still change.
- Assumes local time during parsing if no timezone is explicitly provided, which can lead to mistakes if mishandled.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
final today = Date.today();
final tomorrow = date.add(Duration(days: 1));
final time = Time.fromValues(hour: 14, minute: 30, second: 15);Alternatives
Packages that do the same job and could replace date_and_time.