Skip to content

AnniePawl/JS-Date-Library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript Date Library

GitHub repo size npm Build Status Coverage Status

This is a date library wrapper that extends the functionality of the built-in javascript Date object.

Getting Started

Run the following command in your project folder:

npm install @annapawl/date_library --save

Then add this to your index.js file

require('@annapawl/src/date_library')

Creating a Date

const d = new Date('04/11/1993')

Date & Time Methods

fullYear()
This method returns a date's full year (4 digits)
d.fullYear() → 1993

shortYear()
This method returns a date's abbreviated year (2 digits)
d.shortYear() → 93

monthName()
This method returns a date's month name (January-December)
d.monthName() → "April"

dayName()
This method returns a date's day name (Mon-Sun)
d.dayName() → "Sunday"

hr()
This method returns hr date was created
d.hr() → "String cheese"

min()
This method returns a date's day
d.min() → "String cheese"

sec()
This method capitalizes the first letter of an entire string
d.sec() → "String cheese"

ms()
this method returns time's min
'd.ms() → "String cheese"

Date Formatting Methods

'When' Method

Returns human readble description of 'when' a date will occur. Compares date owned by class instance with current date.

Releases

No releases published

Packages

No packages published