Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nathanhornby/emojiclock
A node package for giving you emoji clocks
https://github.com/nathanhornby/emojiclock
emoji node time
Last synced: about 5 hours ago
JSON representation
A node package for giving you emoji clocks
- Host: GitHub
- URL: https://github.com/nathanhornby/emojiclock
- Owner: nathanhornby
- License: mit
- Created: 2017-04-04T17:51:30.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-05T14:06:01.000Z (almost 8 years ago)
- Last Synced: 2024-12-21T08:08:22.451Z (about 1 month ago)
- Topics: emoji, node, time
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# 🕒 emojiclock
[![Code Climate](https://codeclimate.com/github/nathanhornby/emojiclock/badges/gpa.svg)](https://codeclimate.com/github/nathanhornby/emojiclock)
A node package for giving you emoji clocks.
## Installing emojiclock
```bash
npm install emojiclock --save
```
```javascript
var emojiclock = require('emojiclock')
```## Using emojiclock
emojiclock returns a clock emoji in the form of a string.
### emojiclock.now
Returns a clock emoji for the current hour:
```javascript
var clock = emojiclock.now() // Let's pretend it's 18:37
console.log(clock + " TICK TOCK: Something happened") // 🕕 TICK TOCK: Something happened
```### emojiclock.get(hour)
Returns a clock emoji for a given hour:
```javascript
var clock = emojiclock.get(3) // 24hr support, i.e. 15 also works
console.log(clock + " TICK TOCK: Something happened") // 🕒 TICK TOCK: Something happened
```### emojiclock.time(time)
Returns a clock emoji for a given timestamp or `Date()` object:
```javascript
var time = new Date('January 23, 1985 20:23:23')
var clock = emojiclock.time(time)
console.log(clock + " TICK TOCK: Something happened") // 🕗 TICK TOCK: Something happenedvar time = 475359803
var clock = emojiclock.time(time)
console.log(clock + " TICK TOCK: Something happened") // 🕗 TICK TOCK: Something happened
```If using a `Date()` object it must be an actual object, not a string representation. A timestamp can be 10 or 13 characters long (seconds/milliseconds) and can be a `string` *or* a `number`.