js判断是否在指定日期时间内@令狐张豪

<script>
	function isDuringDate(){
		var curDate = new Date(),
            beginDate = new Date(beginDateStr),
            endDate = new Date(endDateStr);
        if (curDate >= beginDate && curDate <= endDate) {
            return true;
         }
            return false;
	}

	const isTime = isDuringDate('2022/01/28 20:00', '2022/01/30 23:59');
	console.log(isTime)  // true or false
</script>

你可能感兴趣的:(js,vue,javascript,前端,vue.js)