Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Create a new Date, accepting more input types than normal, like Unix timestamps.
JavaScript CSS
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
History.md
Makefile
Readme.md
component.json
package.json

Readme.md

new-date

Create a new Date, accepting more input types than normal, like Unix timestamps.

Installation

$ component install segmentio/new-date

API

newDate(Date|String|Number)

Returns a new Date object created from the input. The input can be:

  • Date objects
  • date strings
  • millisecond numbers
  • second numbers
  • millisecond strings
  • second strings
var newDate = require('new-date');

newDate(new Date);
newDate('Wed, 09 Aug 1995 00:00:00 GMT');
newDate('Aug 9, 1995');
newDate('2011-10-10T14:48:00');
newDate(1363288923637);
newDate(1363288923);
newDate('1363288923637');
newDate('1363288923');

License

MIT

Something went wrong with that request. Please try again.