Skip to content

JavaScript Awesome Calculate Date Utils. AddDays, AddMonths etc...

License

Notifications You must be signed in to change notification settings

laurus-tech/calculate-date

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript Awesome Calculate Date Utils

JavaScript Awesome Calculate Date Utils. AddDays, AddMonths etc...

Installation

npm install calculate-date

or

yarn add calculate-date

Usage - Sample

import { getCurrentQuertar } from "calculate-date";

<div>{getCurrentQuertar()}</div>;

使用效果图如下

效果图


效果图

Functions

Function Desc Params Desc
getCurrentQuertar() 获取当前时间的季度 -
getQuarterStartMonth(quarter) 获取季度开始的月份 quarter只能是1,2,3,4;返回对应的开始月份
AddDays(day, n) 获取某天的前几天或者后几天的日期 p1. 某天日期
p2. 后几天的天数,负值代表前几天
AddMonths(day, n) 获取某天的前几个月或者后几个月的日期 p1. 某天日期
p2. 后几个月的月数,负值代表前几个月
getFutureYearDays(n) 获取未来几年的日期 p1. 年数,负值代表之前
getFutureYearDays(n) 获取未来几年的日期 p1. 年数,负值代表之前
getFirstWeekBegDay(year) 获取某年的第一周开始日期 p1. 年份
getWeekStartDate(year, n) 获取某年某一周的开始日期 p1. 年份
p2. 周数 (一般为 1 - 52)
getWeekEndDate(year, n) 获取某年某一周的结束日期 p1. 年份
p2. 周数 (一般为 1 - 52)
getMonthStartDate(year, n) 获取某年某一月的开始日期 p1. 年份
p2. 月数
getMonthEndDate(year, n) 获取某年某一月的结束日期 p1. 年份
p2. 月数
getQuarterStartDate(year, n) 获取某年某一季度的开始日期 p1. 年份
p2. 季度
getQuarterStartDate(year, n) 获取某年某一季度的结束日期 p1. 年份
p2. 季度

Playground

git clone https://github.com/laurus-tech/js-awesome-date-utils.git

cd js-awesome-date-utils

npm install

npm run dev
访问地址 http://localhost:11000/

即可看到效果如上图所示

License

MIT Copyright (c) 2019 Laurus-Tech

About

JavaScript Awesome Calculate Date Utils. AddDays, AddMonths etc...

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published