day 0.3.2




day.dart logo

A date library Day.js in dart. With nearly the same API.

Pub Travis CI GitHub

Day.dart is inspired by Day.js. Write with nearly the same API. Build on the top of the powerful DateTime class.

  • 🕒 Nearly the same API as Day.js
  • 💪 Contains Immutable Methods
  • 🔗 Chainable
  • 👀 Useful formatting method
  • ⚙️ Plugin system

API Documentation #

📚 API Documentation

Plugins #

⚙️ Plugins

Todo #

🌐 I18n support

License #

Distributed under the MIT License (MIT).

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[0.3.2] - 2019-07-12

  • Update pubspec

[0.3.1] - 2019-07-12

  • Now Day.dart join into the dayjs organization

[0.3.0] - 2019-05-31

  • Plugin system supported

[0.2.2] - 2019-05-29

  • Update docs
  • Fixes .weekday() method's problem
  • Update the type checking

[0.2.1] - 2019-05-09

  • Add API reference
  • Now .timezoneOffset returns Duration

[0.2.0] - 2019-05-08

Add .format() method

[0.1.2] - 2019-05-03

Update README and example

[0.1.1] - 2019-05-03

Fixes pub related info

[0.1.0] - 2019-05-03

First version

example/main.dart

// View https://github.com/g1eny0ung/day.dart for more usage.

import 'package:day/day.dart';

void main() {
  final now = Day();

  // After one day
  final afterOneDay = now.add(1, 'date');
  print(afterOneDay);

  // Chainable
  now
    ..setYear(2020)
    ..setMonth(5)
    ..setDate(1)
    ..finished();

  // Get year
  print(now.year());
}

Use this package as a library

1. Depend on it

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


dependencies:
  day: ^0.3.2

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:day/day.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
46
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
73
Learn more about scoring.

We analyzed this package on Jul 17, 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:day/day.dart.

Health suggestions

Fix lib/src/day.dart. (-1 points)

Analysis of lib/src/day.dart reported 2 hints:

line 1 col 28: Use lowercase_with_underscores when specifying a library prefix.

line 2 col 24: Use lowercase_with_underscores when specifying a library prefix.

Fix lib/src/utils.dart. (-0.50 points)

Analysis of lib/src/utils.dart reported 1 hint:

line 1 col 28: Use lowercase_with_underscores when specifying a library prefix.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
Dev dependencies
test ^1.6.2

Admin