问题描述
您好,我正在一个客户希望在12:00 PM更新变量的项目中
技术:
- CodeIgniter 3
- Bootstrap 4 js
- jQuery UI 任何帮助将不胜感激!
解决方法
这是如何完成此操作的基本指南...
// Set the next delivery date
var NextDelivery = null;
function CalcTimeOut(){
var cutOffTime = new Date();
var currentTime = new Date();
var difference = null;
if(cutOffTime.getHours() < 12) {
// If we are before 12 we can deliver today
cutOffTime.setHours(12,0);
NextDelivery = new Date();
} else {
// Set new cutoff time
cutOffTime.setHours(36,0);
// If we are after 12 we can only deliver tomorrow.
var currentDate = new Date();
currentDate.setDate(currentDate.getDate() + 1);
currentDate.setHours(0,0);
NextDelivery = currentDate;
}
var difference = (cutOffTime.getTime() - currentTime.getTime());
// Recalculate if we need to...
setTimeout(function(){
CalcTimeOut();
},difference);
}
// Call from where ever you need to.
CalcTimeOut();
,
我查看了Huhammad Ahmod的代码,它确实帮助我解决了该问题。 顺便说一下,这是我得出的问题的解决方法。 index.html
ModuleNotFoundError: No module named 'setuptools._distutils'
在 app.js 中,我做了以下事情:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="app.js"></script>
<title>Document</title>
</head>
<body>
<input type="date" id="date">
</body>
</html>
然后使用小于10的格式解决输入类型为“日期”的YYYY-MM-DD错误的格式问题