当前位置:网站首页>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 ~
边栏推荐
- 2022牛客多校第二场
- MVVM model
- TS interface
- 反射之类加载过程
- Implementation of mesh parameterized least squares conformal maps (3D mesh mapping to 2D plane)
- [Database Foundation] summary of MySQL Foundation
- XxE & XML external entity injection utilization and bypass
- Qt风格(QSS)应用之QProgressBar
- Reduce method of array
- Good news under the epidemic
猜你喜欢

Swap, move, forward, exchange of utility component learning

Npm+ module loading mechanism

Unexpected dubug tricks

ES6 syntax (difference between let, const, VaR, deconstruction assignment, arrow function, residual parameters, extension method of array)

【MUDUO】EventLoop事件循环

S4/hana ME21N create Po output control message button missing solution (switch EDI output mode brf+ to Nast mode)

Several commonly used traversal methods

Classes and objects (3)

initializer_list工具库学习

行云管家V6.5.1/2/3系列版本发布:数据库OpenAPI能力持续强化
随机推荐
【微信小程序】页面导航
[QNX Hypervisor 2.2用户手册]9.8 load
Taobao Search case
1913. Maximum product difference between two number pairs - no sorting required
数组中重复的数字
疫情之下的好消息
Docker 安装 Redis-5.0.12(远程访问)
[QNX hypervisor 2.2 user manual]9.8 load
Scaffold installation
Duplicate numbers in array
Rendering, filtering (filtering) and sorting of lists
Matchmaker's words
Learning exploration - waves
MVVM model
Deep and shallow copies
Serialize data type
新手开户选择哪个券商公司好呢?安全吗
Solution of phpstudy service environment 80 port occupied by process system under Windows
Canada EE channel
initializer_ List tool library learning