date-convert
v0.1.2
Published
Convert a Date into a human readable sentence.
Downloads
10
Maintainers
Readme
Sentence Format Date Converter
This library is meant for applications to take dates in a standard format (string
or Date object
) and convert them into a human readable, sentence format.
Installation
Install via npm:
$ npm install date-convert
Or via yarn:
$ yarn add date-convert
Translate the Dates!
The main function in this library will take any string date or Date object and convert it to a sentence. This is an example of how to use it:
const convertDate = require('date-convert');
convertDate("2015-03-25") // => 'March twenty fifth, two thousand fifteen'
Any format that can be read by the Date constructor will be able to be converted. Here are some common formats:
convertDate('2010-03-25') // => 'March twenty fifth, two thousand ten'
convertDate('07/04/1776') // => 'July fourth, seventeen seventy six'
convertDate('August 29 2456') // => 'August twenty ninth, two thousand fifty six'
convertDate('01/01/2000') // => 'January first, two thousand'
convertDate('Tuesday March 15, 462') // => 'March fifteenth, four hundred sixty two'
License
Copyright Lance Turri. Released under the terms of the MIT license.