cn_datetime_utils 0.1.0 copy "cn_datetime_utils: ^0.1.0" to clipboard
cn_datetime_utils: ^0.1.0 copied to clipboard

A Flutter package add more power to default DateTime and Duration class.

Datetime Utils #

A Flutter package add more power to default DateTime and Duration class.

Features #

  • New unit "quarter".
  • Number of days in month, quarter and year.
  • Start and end of each unit.
  • Initialize duration faster.
  • New operator add(+), subtract(-) and compare(>, <, >=, <=) for DateTime.

Getting started #

Add this package to your dependency:

dependencies:
  cn_date_time: ^0.1.0

Add import and have fun:

import 'package:cn_datetime_utils/cn_datetime_utils.dart';

Usage #

  • To use NEW unit "quarter":
final now = DateTime.now();
final foo = now.quarter;
  • To know the number of days of month:
final now = DateTime.now();
final foo = now.daysOfMonth;
  • To get start or end of day:
final now = DateTime.now();
final foo = now.startOfDay;
final bar = now.endOfDay;
  • To initialize duration:
// 2 minutes and 6 seconds
final foo = 2.1.minute;

// 3 days
final bar = 3.day;
  • To use NEW operator:
final now = DateTime.now();
final foo = now + 3.minute;
if (foo >= now) {
  // Do something
}
0
likes
150
pub points
0%
popularity

Publisher

unverified uploader

A Flutter package add more power to default DateTime and Duration class.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on cn_datetime_utils