ymd

1.0.0 • Public • Published

ymd

JavaScript component to return the year, month, and day. Call toString() and returns YYYY-MM-dd from Date object.

Why?

It's really useful to get a date in the format of YYYY-MM-dd.

Install

npm i --save ymd

Methods

ymd([date])

  • returns an object using local timezone. Object contains following members: year, month, day, ymd, and toString().

ymd.utc([date])

  • returns using UTC timezone.

Example

var ymd = require('ymd')
 
console.log(ymd(new Date('2013-03-05 4:43 PM').ymd))
// => '2013-03-05'
 
console.log(ymd().ymd)
// => date in 'YYYY-MM-dd' format

License

(MIT License)

Copyright (c) JP Richardson

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    7
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    7
  • 0.1.0
    0
  • 0.0.1
    8

Package Sidebar

Install

npm i ymd

Weekly Downloads

5

Version

1.0.0

License

MIT

Last publish

Collaborators

  • jprichardson