当前位置:网站首页>js获取上个月第一天以及本月的最后一天
js获取上个月第一天以及本月的最后一天
2022-06-29 14:52:00 【不一般的菜瓜】
工作需求:禁止用户选择除上个月和本月之外的日期
// 配置项
{
label: '处罚日期',
prop: 'punishDate',
type: 'date',
rules: [RULES.required],
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd',
pickerOptions: {
disabledDate: (time) => {
const arr = $this.getDisabledDate()
return time.getTime() < arr[0] || time.getTime() > arr[1]
}
}
}
// 方法
getDisabledDate() {
const date = new Date()
const year = date.getFullYear()
const month = date.getMonth() //
const day2 = new Date(year, month + 1, 0)
const a = `${
year}-${
month}-01`
const b = `${
day2.getFullYear()}-${
day2.getMonth() + 1}-${
day2.getDate()}`
const firstDay = new Date(a).getTime() // 上个月第一天
const lastDay = new Date(b).getTime() // 本月最后一天
return [firstDay, lastDay]
}
边栏推荐
- For example, the visual appeal of the live broadcast of NBA Finals can be seen like this?
- Is it safe to open a stock account at present? Can I open an account online directly
- 关于遥感图像解译的思考
- Solidworks零件图存放位置更改后装配图识别不出来的解决办法
- kubernetes Unable to connect to the server: x509: certificate has expired or is not yet valid
- How does a two character name become a three character name with spaces
- Trigonometric function corresponding to drawing circle on plane coordinate
- Informatics Olympiad 1001:hello, world!
- go学习(四、面向接口)
- Lumiprobe 活性染料丨杂染料:BDP FL 神经酰胺
猜你喜欢

如临现场的视觉感染力,NBA决赛直播还能这样看?

卫龙更新招股书:年营收48亿 创始人刘卫平家族色彩浓厚

Lumiprobe 活性染料丨羧酸:Sulfo-Cyanine7.5羧酸

Lumiprobe reactive dye miscellaneous dye: BDP FL ceramide

Lumiprobe click chemistry - non fluorescent alkyne: hexanoic acid STP ester

EMC surge protection and decoupling design

Chapter IX app project test (the end of this chapter)

MySQL的json 数组操作 json_array_append、json_array_insert

Northwestern Polytechnic University attacked by overseas e-mail

Lumiprobe 脱氧核糖核酸丨炔烃dT亚磷酰胺
随机推荐
Huali biology rushes to the scientific innovation board: the annual revenue is RMB 226million and it is planned to raise RMB 800million
Informatics Olympiad all in one 1194: mobile route
PostgreSQL learning (based on rookie course)
Unity C# 基础复习27——委托示例(P448)
Informatics Olympiad all in one 1003: aligned output
材质 动态自发光
konva系列教程4:图形属性
Informatics Olympiad all in one 2061: trapezoidal area
render后续来了,封装一个表单往表格中添加数据
信息学奥赛一本通2061:梯形面积
Unity C# 基础复习28——带返回的委托(P449)
第九章 APP项目测试(4) 测试工具
I am 35 years old. Can I change my career to be a programmer?
Draw a slash on a plane coordinate
LeetCode笔记:Biweekly Contest 81
synchronized 与多线程的哪些关系
Create an API rapid development platform, awesome!
携程季报图解:净营收41亿 与疫情前相比已被“腰斩”
Ink drop typesetting
NFS configuring file mapping between two hosts