0 purchases
cn datetime utils
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
copied to clipboard
Add import and have fun:
import 'package:cn_datetime_utils/cn_datetime_utils.dart';
copied to clipboard
Usage #
To use NEW unit "quarter":
final now = DateTime.now();
final foo = now.quarter;
copied to clipboard
To know the number of days of month:
final now = DateTime.now();
final foo = now.daysOfMonth;
copied to clipboard
To get start or end of day:
final now = DateTime.now();
final foo = now.startOfDay;
final bar = now.endOfDay;
copied to clipboard
To initialize duration:
// 2 minutes and 6 seconds
final foo = 2.1.minute;
// 3 days
final bar = 3.day;
copied to clipboard
To use NEW operator:
final now = DateTime.now();
final foo = now + 3.minute;
if (foo >= now) {
// Do something
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.