ms_datetime_extensions 0.3.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 64

Overview Pub GitHub stars #

A simple lib to incremease DateTime with usefull functions

Whats Ms_DateTime_Extensions do #

Add usefull functions to DateTime:

  • nextWeekday return a new DateTime to a next weekday
  • fromInternet fetch a DateTime from internet
  • isAtSame[second,minute,hour,day,mount,year] return true when compare datetime to other
  • isAtToday return true if DateTime is today
  • copyWith return a new DateTime with new values

Usage #

Just import lib and use extensions, call the functions to starts work:

import 'package:ms_datetime_extensions/ms_datetime_extensions.dart';

  var xmas = DateTime(2020, 12, 25, 15, 00); // Friday 25 december of 2020
  var nextFriday =
      xmas.nextWeekday(DateTime.friday); // Friday 01 january of 2021
  print(nextFriday);

  var mDateTimeFromInternet = await dateTimeFromInternet();

  var endYear = xmas.copyWith(day: 0); // Thursday 31 dezember of 2020

This lib use thirtpart API visite to know more worldtimeapi

Changelog #

[0.3.0] - 24/04/2020 #

  • copyWith create a new DateTime with new values

[0.2.0] - 24/04/2020 #

  • some functions to chech if a datetime is the same second, minute, hour, day, mount or year

[0.1.0+1] - 10/03/2020 #

  • flutter format
  • better lib description

[0.1.0] - 10/03/2020 #

First Release #

  • get DateTime from internet
  • get DateTime to next weekday

example/main.dart

import 'package:ms_datetime_extensions/ms_datetime_extensions.dart';

Future<void> main(List<String> args) async {
  var xmas = DateTime(2020, 12, 25, 15, 00); // Friday 25 december of 2020
  var nextFriday =
      xmas.nextWeekday(DateTime.friday); // Friday 01 january of 2021
  print(nextFriday);

  var myDateTimeFromInternet = await dateTimeFromInternet();
  print(myDateTimeFromInternet);
}

Use this package as a library

1. Depend on it

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


dependencies:
  ms_datetime_extensions: ^0.3.0

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:ms_datetime_extensions/ms_datetime_extensions.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
29
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]
64
Learn more about scoring.

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

  • Dart: 2.8.2
  • pana: 0.13.8-dev

Health issues and suggestions

Document public APIs. (-0.02 points)

371 out of 384 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/src/copy_with.dart.

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
http ^0.12.0 0.12.1
Transitive dependencies
charcode 1.1.3
collection 1.14.12
http_parser 3.1.4
meta 1.1.8
path 1.7.0
pedantic 1.9.0
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
test ^1.9.2