当前位置:网站首页>How does JS judge whether the current date is within a certain range
How does JS judge whether the current date is within a certain range
2022-07-25 23:39:00 【front-end technology】
JS How to judge whether the current date is within a certain range
Don't talk much , Go straight to the code :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
var date = {
isDuringDate: function (beginDateStr, endDateStr) {
let curDate = new Date(),
beginDate = new Date(beginDateStr),
endDate = new Date(endDateStr);
if (curDate >= beginDate && curDate <= endDate) {
return true;
}
return false;
}
}
console.log(date.isDuringDate('2022/03/06', '2030/09/17'));
</script>
</body>
</html>
Running effect :
All right. , I hope that's helpful , Thank you for your attention ~
边栏推荐
- [QNX hypervisor 2.2 user manual]9.6 GDB
- 反射之类加载过程
- Docker 安装 Redis-5.0.12(远程访问)
- What is the difference between'1 and'b1 when assigning values
- Implementation of mesh parameterized least squares conformal maps (3D mesh mapping to 2D plane)
- [QNX Hypervisor 2.2用户手册]9.8 load
- 学习探索-3d轮播卡片
- [Muduo] package EventLoop and thread
- [nodejs] nodejs create a simple server
- Optimize the browsing experience of yandere/konachan site with user scripts
猜你喜欢

S4/hana mm & SD EDI Nast based integrated configuration (orders, ordrsp, desadv, invoice)

Graph traversal DFS, BFS (code explanation)

利用用户脚本优化 Yandere/Konachan 站点浏览体验

Leetcode 0919. complete binary tree inserter: array representation of complete binary tree

Leetcode 0135. distribute candy

What is the difference between'1 and'b1 when assigning values

ratio学习之ratio_add,ratio_subtract,ratio_multiply,ratio_divide的使用

Node Foundation

S4/HANA MM & SD EDI基于NAST的集成配置(ORDERS, ORDRSP, DESADV, INVOIC)

ABAP 代码中读取会计科目的字段状态(隐藏、可选、必输)
随机推荐
R语言安装教程 | 图文介绍超详细
疫情之下的好消息
Which securities company should a novice choose to open an account? Is it safe?
This point inside the function / change this point inside the function
Query commodity cases (operate data with array addition method) / key points
赋值时'1和'b1有什么区别
Taobao Search case
Which securities firm is the best and safest for beginners to open an account
Idea sets get and set templates to solve the naming problem of boolean type fields
Summary of built-in instructions and custom instructions
E-commerce RPA, a magic weapon to promote easy entry
SAP Message No. VG202 IDoc E1EDK18 中付款条款已经转移:检查数据
[JUC] concurrent keyword volatile
POI special effects Market Research
Grain Academy p98 trample pit e.globalexceptionhandler: null
Serialize data type
About the foundation of fetch
Data intensive application system design - Application System Overview
ES6 syntax (difference between let, const, VaR, deconstruction assignment, arrow function, residual parameters, extension method of array)
Numerical learning iota, accumulate