Socket
Book a DemoInstallSign in
Socket

occasion

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

occasion

A date formatting library

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

occasion

A date formatting library based on moment.js. By only doing date formatting it is kept really small, and by not dealing with times, it avoids having to deal with time zones. Pass in your date as a string in the form YYYY-MM-DD and get it in a nice format to display to your users.

Build Status Dependency Status NPM version

Installation

npm install occasion

##Usage

var formatDate = require('occasion');

assert.deepEqual(formatDate('2014-06-01', 'Do MMM YYYY'), '1st Jun 2014');
assert.deepEqual(formatDate('2014-06-01', 'ddd D MMM'), 'Sun 1 Jun');

Tokens:

TokenOutput
YearYY70 71 ... 29 30
YYYY1970 1971 ... 2029 2030
MonthM1 2 ... 11 12
Mo1st 2nd ... 11th 12th
MM01 02 ... 11 12
MMMJan Feb ... Nov Dec
MMMMJanuary February ... November December
Day of MonthD1 2 ... 30 31
Do1st 2nd ... 30th 31st
DD01 02 ... 30 31
Day of WeekddSu Mo ... Fr Sa
dddSun Mon ... Fri Sat
ddddSunay Monday ... Friday Saturday

License

MIT

FAQs

Package last updated on 23 Jun 2017

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