当前位置:网站首页>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]
}
边栏推荐
- Lumiprobe reactive dye cycloalkyne dye: af488 dbco, 5 isomer
- Draw a slash on a plane coordinate
- 微信公众号—菜单
- Secondary pointer
- 极化SAR地表分类
- How does a two character name become a three character name with spaces
- Implementing redis distributed locks using custom annotations
- BioVendor游离轻链(κ和λ)Elisa 试剂盒的化学性质
- Chapter IX app project test (4) test tools
- Informatics Olympiad all in one 2061: trapezoidal area
猜你喜欢

Create an API rapid development platform, awesome!

MCS:离散随机变量——Binomial分布

揭秘百度智能测试在测试自动执行领域实践

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

EMC surge protection and decoupling design

数据挖掘复习

Lumiprobe deoxyribonucleic acid phosphate CpG 1000 solid carrier

render后续来了,封装一个表单往表格中添加数据

Chapter IX app project test (4) test tools

You need to know about project procurement management
随机推荐
go学习(四、面向接口)
Abnormal logic reasoning problem of Huawei software test written test [2] Huawei hot interview problem
Jet hydrogen technology rushes to the scientific innovation board: SAIC Group is the major shareholder to raise 1.06 billion yuan
NFS configuring file mapping between two hosts
MCS: discrete random variable - binomial distribution
Chapter IX app project test (the end of this chapter)
Wechat official account - menu
在shop工程中,实现一个菜单(增删改查)
Evaluation index of high concurrency software (website, server interface)
Huashu high tech rushes to the scientific innovation board: the actual controller xuxiaoshu and his son, who plan to raise 660million yuan, are both American nationals
BioVendor游离轻链(κ和λ)Elisa 试剂盒的化学性质
CKS CKA ckad change terminal to remote desktop
Research Report on research and development prospect of China's urea dioxide industry (2022 Edition)
投资reits基金是靠谱吗,reits基金安全吗
curl: (56) Recv failure: Connection reset by peer
CKS CKA CKAD 将终端更改为远程桌面
render后续来了,封装一个表单往表格中添加数据
kubernetes Unable to connect to the server: x509: certificate has expired or is not yet valid
Ink drop typesetting
MCS: multivariate random variable - discrete random variable