dart_days 0.0.8

  • Readme
  • Changelog
  • Example
  • Installing
  • 78

Simple yet powerful Dart and Flutter Date manipulation package.

Usage #

A light weight dart library for date manipulation:

import 'package:dart_days/dart_days.dart';
void main() {
   var dartDays = DartDays();
   print('Times Ago: ${dartDays.timesAgo(DateTime.parse('2020-01-02'))}');
   print('Times Left: ${dartDays.timesLeft(DateTime.parse('2020-01-02'))}');
   print("Number of days in current month: ${DartDays.numberOfDaysInThisMonth()}");
  print('Days Name of week: ${DartDays.daysNameOfWeek().join(", ")}');
  print('Name of this month ${DartDays.nameOfMonth(1)}');

Features and bugs #

Please file feature requests and bugs at the issue tracker.

0.0.8 #

  • Times ago hour, minute and seconds issue fixed.

0.0.7+hotfix.9 #

  • A method for getting days for a weekday for a particular date and provided weekday.
  • Seven new methods for getting days for a weekday for a particular date.

0.0.7+hotfix.7 #

  • Added support to get first day of month for any year weekDayOfFirstDayOfMonth.

0.0.7+hotfix.6 #

  • Added parameter for daysNameOfWeek() to get sunday as first element in List.

0.0.7+hotfix.5 #

  • Added support for getting weekday for any month by providing a parameter to DartDays.weekDayOfFirstDayOfMonth(month: 1).

0.0.7+hotfix.4 #

  • DartDays.nameOfFirstDayOfMonth() incorrect issue fixed.
  • DartDays.weekDayOfFirstDayOfMonth() to get the first day of month day(as number).
  • Example updated with fixing a bug.

0.0.7+hotfix.2 #

  • Method to get name of the week day (1 up to 7) name and name of the first day of month Ex: Sunday. DartDays.nameOfTheWeekDay() and DartDays.nameOfFirstDayOfMonth()

0.0.7+hotfix.1 #

  • Method for to get number of days for any month / year. DartDays.numberOfDaysForDate(DateTime("2019-02-02""))

0.0.7 #

  • Method for to get name of any month. DartDays.nameOfMonth(2)

0.0.6+hotfix.2 #

  • Method for to get number of days in any month. DartDays.numberOfDaysInMonth()

0.0.6+hotfix.1 #

  • type 'MappedListIterable<String, String>' is not a subtype of type 'List<String>' issue fixed.

0.0.6 #

  • A method for getting weekdays / names of the days in a week. DartDays.daysNameOfWeek();

0.0.5+hotfix.1 #

  • A method for getting number of days in this/current month. DartDays.numberOfDaysInThisMonth();

0.0.4 #

  • Ago prefix not showing bug fixed.

0.0.3 #

  • Tested and working fine.

0.0.2-dev.1 #

  • Given a parameter to add from date and to date for timesLeft.

0.0.2 #

  • Dart SDK change to 2.5.0 from 2.7.0.

0.0.1 #

  • timesLeft function added.

0.0.1-dev.1 #

  • Initial version, with timesAgoShort function.


import 'package:dart_days/dart_days.dart';

void main() {
  var dartDays = DartDays();
  print('Times Ago: ${dartDays.timesAgo(DateTime.parse('2020-05-11 09:22:26.546339'))}');
  print('Times Left: ${dartDays.timesLeft(from: DateTime.parse('2019-01-02'), to: DateTime.parse('2020-01-02'))}');
  print('Get number of days in current month: ${DartDays.numberOfDaysInThisMonth()}');
  print('Days Name of week: ${DartDays.daysNameOfWeek(sundayFirst: true).join(", ")}');
  print('Name of this month: ${DartDays.nameOfMonth(DateTime.now().month)}');
  print('Name of the first day of this month: ${DartDays.nameOfFirstDayOfMonth()}');
  print('Weekday of month: ${DartDays.weekDayOfFirstDayOfMonth(month: 3)}');
  print('This month days for Saturday: ${DartDays.dayOfSaturdayForDate(DateTime.now())}');
  print('This month days for Saturday: ${DartDays.daysInWeekdayForDate(6, DateTime.now())}');

Use this package as a library

1. Depend on it

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

  dart_days: ^0.0.8

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

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

  • Dart: 2.8.4
  • pana: 0.13.13

Health suggestions

Format lib/src/dart_days_base.dart.

Run dartfmt to format lib/src/dart_days_base.dart.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0 <3.0.0
Dev dependencies
pedantic ^1.8.0
test ^1.6.0