@nlib/date-string

Converts a date to a formatted string

Stats

StarsIssuesVersionUpdatedCreatedSize
@nlib/date-string
001.0.14 years ago4 years agoMinified + gzip package size for @nlib/date-string in KB

Readme

@nlib/date-string

Build Status Build status codecov dependencies Status devDependencies Status

Converts an integer to a human readable format.

Install

npm install @nlib/date-string

Usage

const console = require('console');
const DateString = require('@nlib/date-string');
const d = new Date(2012, 3, 4, 5, 6, 7);
const date1 = new DateString('[YYYY]-[MM]-[DD] [hh]:[mm]:[ss]');
console.log(date1(d));
// 2012-04-04 05:06:07
const date2 = new DateString('[YYYY]-[MMM]-[MMMM]-[D] [ddd] [dddd] [h]:[m]:[s]');
console.log(date2(d));
// 2012-Apr-April-4 Wed Wednesday 5:6:7

Javascript API

new DateString(format: String) → fn(...args) → String

  • format: A string to format the given date-string.
  • args: is passed to construct a date-string object.

LICENSE

MIT

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.