date-formatter-js v1.0.0
date-formatter-js
Format the date as yyyy-MM-dd hh:mm:ss or yyyy/MM/dd hh:mm:ss or yyyy-MM-dd or yyyy/MM/dd or hh:mm:ss
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.