date_calc 0.1.1+3

date_calc #

Date manipulation library for easy calculating.

Usage #

Installation #

Add date_calc as a dependency in pubspec.yaml file.

dependencies:
  date_calc: ^0.1.0

Run pub install.

Using #

import 'package:date_calc/date_calc.dart';

final date = DateCalc(2019, 1, 5);
print(date.addMonth(1));
// => 2019-02-05 00:00:00.000
print(date.addYear(1).isLeapYear());
// => true
print(date.addYear(1).addMonth(1).daysInMonth());
// => 29
print(date.dup(minute: 11));
// => 2019-01-05 00:11:00.000
print(date.differenceValue(date: DateTime(2019, 3, 3), type: DateType.month));
// => 1
print(DateCalc.now().isToday());
// => true

Because DateCalc is a subclass of DateTime, you can use all DateTime methods.
When you need exactly DateTime object, use toDate() method.

final date = DateCalc(2019, 1, 5);
date.subtractYear(1).toDate();

milestones for 1.0.0 #

  • support for DST
  • support for UTC & Timezone
  • support for leapsecond

0.1.1+3 #

  • Fix to toDate method returns correct isUtc parameter.

0.1.1+2 #

  • Add remaining add & subtract methods.

0.1.1+1 #

  • Remove [initializeDateFormatting] from toFormattedString.
    As it affects for app, it should be called from app codes.

0.1.1 #

  • Add parse method.
  • Add toFormattedString method.

0.1.0+1 #

  • Fix dependency version.

0.1.0 #

  • Initial Open Source release.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  date_calc: ^0.1.1+3

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:date_calc/date_calc.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
53
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
75
Learn more about scoring.

We analyzed this package on Aug 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:date_calc/date_calc.dart.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and date_calc.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
intl ^0.15.7 0.15.8
meta ^1.1.0 1.1.7
Transitive dependencies
path 1.6.4
Dev dependencies
test ^1.6.3