Library to easily convert various time formats to milliseconds and milliseconds to human readable format.
Add this to your package's pubspec.yaml
file:
dependencies:
millisecond: 0.1.0
import "package:millisecond/millisecond.dart" as ms;
// `String` to `int`
ms.parse("5h"); // => 18000000
ms.parse("20 sec"); // => 20000
ms.parse("1.5 hours"); // => 5400000
ms.parse("day"); // => null
ms.parse("2y"); // => 63115200000
// `num` to `String`
// Short format
ms.format(200); // 200ms
ms.format(1000); // 1s
ms.format(60 * 60 * 1000 * 6); // 6h
// Long format
ms.format(200, long: true); // 200 ms
ms.format(1000, long: true); // 1 second
ms.format(60 * 60 * 1000 * 6, long: true); // 6 hours
// `num` to `String`
// Short format
ms.format(60 * 60 * 1000 * 6); // => "6h"
// Long format
ms.format(1000, long: true); // => "1 second"
pub run test
git checkout -b feature/<feature_name>
)git commit -am '<type>(<scope>): added some feature'
)git push origin feature/<feature_name>
)Add this to your package's pubspec.yaml file:
dependencies:
millisecond: ^0.1.0
You can install packages from the command line:
with pub:
$ pub get
Alternatively, your editor might support pub get
.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:millisecond/millisecond.dart';
Version | Uploaded | Documentation | Archive |
---|---|---|---|
0.1.0 | Jul 6, 2017 |
|
|
Popularity:
Describes how popular the package is relative to other packages.
[more]
|
24
|
Health:
Code health derived from static analysis.
[more]
|
--
|
Maintenance:
Reflects how tidy and up-to-date the package is.
[more]
|
--
|
Overall:
Weighted score of the above.
[more]
|
12
|
The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.
Support Dart 2 in pubspec.yaml
.
The SDK constraint in pubspec.yaml
doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.
Make sure dartdoc
successfully runs on your package's source files. (-10 points)
Dependencies were not resolved.