Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/toymachiner62/simple-time
Super simple javascript time methods so you don't have to calculate milliseconds.
https://github.com/toymachiner62/simple-time
Last synced: 30 days ago
JSON representation
Super simple javascript time methods so you don't have to calculate milliseconds.
- Host: GitHub
- URL: https://github.com/toymachiner62/simple-time
- Owner: toymachiner62
- Created: 2014-12-17T19:13:41.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2014-12-17T19:44:11.000Z (almost 10 years ago)
- Last Synced: 2024-09-13T22:58:57.557Z (2 months ago)
- Language: JavaScript
- Size: 141 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# simple-time [![Build Status](https://travis-ci.org/toymachiner62/simple-time.svg)](https://travis-ci.org/toymachiner62/simple-time)
> Super simple javascript time methods so you don't have to calculate milliseconds.
Ever tried to calculate how many miliseconds are in an hour? A day? 2.5 months? It sucks looking at code that calculates it like `1000 * 60 * 60 * 24...`.
This library is extremely simple and allows you to specify time in milliseconds quickly, easily, and in a readable format.
# Usage
All of these methods produce time in milliseconds.
```js
var Time = require('simple-time');console.log(Time.MINUTE) // A minute
console.log(5 * Time.MINUTE) // 5 minutes// setTimeout example that waits 30 seconds
setTimeout(function() {
// Do something
}, 30 * Time.SECOND);// setTimeout example that waits 2 hours
setTimeout(function() {
// Do something
}, 2 * Time.HOUR);
```# API
- `SECOND`
- `MINUTE`
- `HOUR`
- `DAY`
- `WEEK`
- `MONTH`
- `YEAR`