Socket
Book a DemoInstallSign in
Socket

ymd

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ymd

JavaScript component to return the year, month, and day string. i.e. returns `YYYY-MM-dd` from Date object.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

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

Keywords

date

FAQs

Package last updated on 23 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts