0.0.4 • Published 6 years ago

bitment v0.0.4

Weekly downloads
4
License
MIT
Repository
-
Last release
6 years ago

Bitment

A tiny time format lib

install

npm i bitment -S

Usage

As CommonJs module

const Bitment = require('bitment');

const today = new Bitment().format('YYYY-MM-DD');

As ES module

import Bitment from 'bitment';

const today = new Bitment().format('YYYY-MM-DD');

Documentation

Paramters

Bitment inherit Date instance. So the paramters are the same as Date instance.

Methods

format(template)
  • Arguments:
    • {string} template
  • Usage: Format a time template string.
    new Bitment().format('YYYY-MM-DD');
    // YYYY -> Year
    // MM -> Month
    // DD -> Day
    // hh -> Hour
    // mm -> Minute
    // ss -> Second
getMap()
  • Usage: Get the object of time.
    new Bitment().getMap(); // { year: '..', month: '..', day: '..', ... }
getDiff
  • Usage: Get the description of time difference.
    new Bitment(Date.now() - 20000000).getDiff(); // 5小时前

LICENSE

MIT

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago