day 0.5.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 85



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.

Important: Day.dart use the extension syntax to implement plugins system. So the dart version must >= 2.7.0

Features #

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

📚 API Documentation

⚙️ Plugins

🌐 I18n

License #

Distributed under the MIT License.

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.5.4]

  • Add toDateTime() method

[0.5.3]

  • Update docs

[0.5.2]

  • Follow health suggestions

[0.5.1] - 2019-12-16

  • Fixes the version of dart

[0.5.0] - 2019-12-16

  • Breaking change: rewrite plugins system with extension syntax
  • Add .isLeapYear() plugin
  • Update some details
  • Update docs

[0.4.1] - 2019-11-17

  • Follow health suggestions

[0.4.0] - 2019-09-03

  • Add i18n support

[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/dayjs/day.dart for more usage.

import 'package:day/day.dart';

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

  // Tomorrow
  final tomorrow = now.add(1, 'date');
  print(tomorrow);

  // Chainable
  now
    ..setYear(2020)
    ..setMonth(1)
    ..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.5.4

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]
71
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
85
Learn more about scoring.

We analyzed this package on Jan 16, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
Dev dependencies
test ^1.6.8