Skip to content
pubscout

date_time

0.12.0, released 2 years ago by devcraft.ninja

Provides Date, Time, and range classes with comparison and manipulation utilities.

WASM-ready
$ flutter pub add date_time
Source repository

What it does

The package defines separate Date and Time objects, supports copying, arithmetic, and overflow handling, and includes DateRange and TimeRange types for interval operations. It also offers extensions on DateTime and integrates with the clock package for testable time sources.

AI-written summary of version 0.12.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need strong typed date or time handling beyond DateTime
  • You work with booking or scheduling logic requiring ranges and overflow logic

Skip it when

  • You only need simple DateTime usage without extra types
  • You require timezone-aware or locale‑specific date handling beyond what intl provides

Strengths

  • Clear separation of date and time concepts
  • Range and overflow support out of the box
  • CopyWith and immutable‑style API

Weaknesses

  • No built‑in timezone or locale‑aware parsing beyond intl
  • Limited ecosystem compared to more mature date libraries

Setup

Kind
Pure Dart
Effort
Low
Code generation
Yes (build_runner)
Direct dependencies
4
import 'package:date_time/date_time.dart';

void main(){
  final date = Date(year:2022, month:5, day:10);
  final time = Time(hour:14, minute:30);
  final range = DateRange(date, date.addDays(5));
  print(range.isValid); // true
}

Alternatives

Packages that do the same job and could replace date_time.

  • simple_date

    A simple date model for Dart with no notion of time.

  • tempo

    A time and date solution replacing core DateTime with advanced arithmetic and time zone support.

  • time_plus

    Extensions for DateTime and Duration to easily add, convert, and work with time in Dart.

  • jiffy

    Parse, manipulate, query, and format dates and times in Dart and Flutter.

Works with

Packages commonly used together with date_time: ones it builds on, ones built on it, and its own family.