1.1.1 • Published 9 years ago

simple-date v1.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

simple-date

Simple, versatile Javascript date formatter that can be run in the browser or required as a module in nodejs. Takes a given date string / object and converts it to desired date format.

install

npm install simple-date

format

Takes 2 arguments, the string or date object you have and the desired format you want (in that order).

ex.

var formattedDate = simpleDate.format(your_date, desired_format);

arguments

Currently takes 5 standard date formats as first arguments and 4 desired formats as second arguments:

ex. first args
  • '09-07-1998' - (dashed format)
  • '09/07/1998' - (slashed format)
  • 'September 07, 1998' - (month/day/year format)
  • '07 September, 1998' - (day/month/year format)

or

  • date object
ex. second args
  • 'dashed' - ex. output: 09-07-1998
  • 'slashed' - ex. output: 09/07/1998
  • 'mdy' - ex. output: September 07, 1998
  • 'dmy' - ex. output: 07 September, 1998
in node.js
var simpleDate = require('simple-date');
var current_date = new Date();
var formattedDate = simpleDate.format(current_date, 'dashed');
console.log(formattedDate);   // logs current_date in dashed format: XX-XX-XXXX
in browser
<script src='path/to/simple-date.js'></script>
<script>
    var current_format = '09/07/1998';
    var new_format = simpleDate(current_format, 'mdy');
    console.log(new_format);    // logs: September 07, 1998
</script>
1.1.1

9 years ago

1.1.0

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.1.1

9 years ago

0.0.9

9 years ago