1.0.8 • Published 2 years ago

opdt v1.0.8

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

OPDT

NPM npm npm collaborators

A tool for operation dates and times.

Import

/* Vue3 */
import opdt from "opdt/index.js";

/* Vue2 */
import opdt from "opdt";

Methods

Params

ParamsDescriptionTypeDefault
dateThe date to be formatted, can be set 'Date', 'yyyy-MM-dd HH:mm:ss', 'yyyyMMdd HHmmss', etc.Date\String\Numbernew Date()
formatSpecifies the format to return, can be set to 'yyyy-MM-dd HH:mm:ss', 'yyyyMMdd HHmmss', 'yyyy 年 MM 月 dd 日', etc.String'yyyy-MM-dd HH:mm:ss'
ParamsDescriptionTypeDefault
dateThe specified date, can be set 'Date', 'yyyy-MM-dd HH:mm:ss', 'yyyyMMdd HHmmss', etc.Date\String\Numbernew Date()
nThe number of days separated from the specified date, it could be negativeNumber0
typeSpecifies the type to return, can be set 'date', 'string'.String'date'
formatSpecifies the format to return, can be set to 'yyyy-MM-dd HH:mm:ss', 'yyyyMMdd HHmmss', 'yyyy 年 MM 月 dd 日', etc.String'yyyy-MM-dd HH:mm:ss'
ParamsDescriptionTypeDefault
date1Date, can be set 'Date', 'yyyy-MM-dd HH:mm:ss', 'yyyyMMdd HHmmss', 'yyyyMMdd', etc.Date\String\Number-
date2Date, can be set 'Date', 'yyyy-MM-dd HH:mm:ss', 'yyyyMMdd HHmmss', 'yyyyMMdd', etc.Date\String\Number-
typeSpecifies the type of each item in the returned array, can be set 'date', 'string'.String'date'
formatSpecifies the format of each item in the returned array, can be set to 'yyyy-MM-dd HH:mm:ss', 'yyyyMMdd HHmmss', 'yyyy 年 MM 月 dd 日', etc.String'yyyy-MM-dd HH:mm:ss'
ParamsDescriptionTypeDefault
dateDate, can be set 'Date', 'yyyy-MM-dd HH:mm:ss', 'yyyyMMdd HHmmss', etc.Date\String\Numbernew Date()

Usage

/* Vue3 */
import opdt from "opdt/index.js";

/* Vue2 */
import opdt from "opdt";


/* formatDate */

opdt.formatDate("20200602", "yyyy年MM月dd日")   // 2020年06月02日

/* getSpecifiedDate */

opdt.getSpecifiedDate("2022-08-13 14:44:23", -1, "string", "yyyy-MM-dd HH:mm:ss")   // 2022-08-12 14:44:23

/* getRangeDate */

opdt.getRangeDate("2022/04/17", "2022/04/19", "date")   // [2022-04-17T00:00:00.000Z, 2022-04-18T00:00:00.000Z,2022-04-19T00:00:00.000Z]

/* getDateObject */

opdt.getDateObject(new Date())   // {year: '2022', month: '11', day: '10', hour: '15', minute: '38', second: '03'}

Thanks

If you have any questions or need to communicate together, you can add wechat: Hyakkiyakou-0995

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago