https://github.com/karan/ms.dart
Tiny milisecond conversion utility for Dart.
https://github.com/karan/ms.dart
Last synced: 26 days ago
JSON representation
Tiny milisecond conversion utility for Dart.
- Host: GitHub
- URL: https://github.com/karan/ms.dart
- Owner: karan
- License: mit
- Created: 2014-11-26T05:04:16.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-11-26T06:26:14.000Z (about 11 years ago)
- Last Synced: 2025-02-12T07:10:56.834Z (11 months ago)
- Language: Dart
- Homepage: https://pub.dartlang.org/packages/ms
- Size: 118 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ms.dart: miliseconds conversion utility
[](https://drone.io/github.com/karan/ms.dart/latest)
Port of [guille/ms.js](https://github.com/guille/ms.js).
## Install
In your `pubspec.yaml` add:
dependencies:
ms: ">=0.0.1"
Then run
$ pub get
## Usage
In your dart code,
```dart
import 'package:typeof/typeof.dart';
```
```dart
ms('2 days'); // 172800000
ms('1d'); // 86400000
ms('10h'); // 36000000
ms('2.5 hrs'); // 9000000
ms('2h'); // 7200000
ms('1m'); // 60000
ms('5s'); // 5000
ms('100'); // 100
```
```dart
ms(60000); // "1m"
ms(2 * 60000); // "2m"
ms(ms('10 hours')); // "10h"
```
```dart
ms(60000, { 'long': true }); // "1 minute"
ms(2 * 60000, { 'long': true }); // "2 minutes"
ms(ms('10 hours'), { 'long': true }); // "10 hours"
```