A Dart library for working with DateTime
- Adding the following lines to the pabspec.yaml file:
dependencies:
work_with_date_and_time:
git:
url: https://github.com/hariuc/work_with_date_and_time.git
-
Run
dart pub get
orflutter pub get
-
Importing the package into your dart code:
import 'package:work_with_date_and_time/work_with_date_and_time.dart';
- Using the
WorkWithDateAndTime
class:
//Example 1
var isLeapYear = WorkWithDateAndTime.isLeapYear(dateTime: DateTime(2021));
print(isLeapYear);
// => false
//Example 2
var beginOfQuarter = WorkWithDateAndTime.beginOfQuarter(dateTime: DateTime(2021, 3));
print(beginOfQuarter);
// => 2021-01-01 00:00:00.000