npm.io
1.0.0 • Published 5 years ago

date-formatter-js

Licence
ISC
Version
1.0.0
Deps
0
Size
5 kB
Vulns
0
Weekly
0

date-formatter-js

Format the date as yyyy-MM-dd hhss or yyyy/MM/dd hhss or yyyy-MM-dd or yyyy/MM/dd or hhss

install

npm install date-formatter-js --save

github

https://github.com/ColinTChen/date-formatter-is.git

usage

import

import { getQuarter, dateFormat, getMonthFirstDay, getMonthLastDay, getMonthDays, getMonthDateArr, getDateArr } from "date-formatter-js"

description

1.getQuarter -- Get quarter
parameter

Date or yyyy-MM-dd or yyyy/MM/dd or timestamp, default new Date().

2.dateFormat -- Format date
parameter

parameter one:Date or yyyy-MM-dd or yyyy/MM/dd or timestamp, default new Date(). parameter two:Date format to be returned, default yyyy-MM-dd.

3.getMonthFirstDay -- Get the first day of the month
parameter

parameter one:Date or yyyy-MM-dd or yyyy/MM/dd or timestamp, default new Date(). parameter two:Date format to be returned, default yyyy-MM-dd.

4.getMonthLastDay -- Get the last day of the month
parameter

parameter one:Date or yyyy-MM-dd or yyyy/MM/dd or timestamp, default new Date(). parameter two:Date format to be returned, default yyyy-MM-dd.

5.getMonthDays -- Get days of the month
parameter

Date or yyyy-MM-dd or yyyy/MM/dd or timestamp, default new Date().

6.getMonthDateArr -- Get array of the first day of month and the last day of month
parameter

parameter one:Date or yyyy-MM-dd or yyyy/MM/dd or timestamp, default new Date(). parameter two:Date format to be returned, default yyyy-MM-dd.

7.getDateArr -- Get array of the date of a few days ago and now
parameter

parameter one:step, default 6, the array of nearly a week. parameter two:Date format to be returned, default yyyy-MM-dd.