p-hatan/ mirror

pub repository

mirror.p-hatan.ir

millisecond

0.1.0

Library to easily convert various time formats to milliseconds and milliseconds to human readable format.

This package is discontinued upstream.

Download archive

Readme

Millisecond

Linux Build Pub version Commitizen friendly

Library to easily convert various time formats to milliseconds and milliseconds to human readable format.

Installing via Pub

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

dependencies:
  millisecond: 0.1.0

Usage

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"

Test

pub run test

Contributing

  1. Fork it (https://github.com/SuperPaintman/ms.dart/fork)
  2. Create your feature branch (git checkout -b feature/<feature_name>)
  3. Commit your changes (git commit -am '<type>(<scope>): added some feature')
  4. Push to the branch (git push origin feature/<feature_name>)
  5. Create a new Pull Request

Contributors


API

Docs


Changelog

Changelog


License

MIT

Changelog

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add millisecond
pubspec.yaml
name: millisecond
version: 0.1.0
authors:
  - SuperPaintman <SuperPaintmanDeveloper@gmail.com>
description: Library to easily convert various time formats to milliseconds and milliseconds to human readable format.
homepage: https://github.com/SuperPaintman/ms.dart
dev_dependencies:
  test: '0.12.23+1'

Version history

VersionPublishedArchiveSHA-256
0.1.02017-07-06T08:00:14.209920ZDownloadacec0e2e68c70229c4f359aff351ec963f4c5f200e5d0d585d791858ac888faa

Dependencies

No direct dependencies declared.