const date = new Date()
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const week = date.getDay()
const hour = date.getHours()
const timeMilli = detail
const amOrPm = hour > 12 ? 'PM' : 'AM'
const dateStr = `${year}-${pad(month)}-${pad(day)}`
var isVacation = false
var params = {
query:year+'年'+month+'月',
ie:'utf8',
oe:'utf-8',
co:'',
resource_id:'39043',
t:'1590458044226',
format:'json',
tn:'wisetpl'
}
$.ajax({
url: 'https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv/api.php', //仅为示例,并非真实的接口地址
data: params,
header: {
'content-type': 'application/json' // 默认值
},
success (res) {
var list = res.data.data[0].almanac
list.forEach(function(item){
if(item.year==year&&item.month==month&&item.day==day){
if(item.hasOwnProperty('status')){
if(item.status==1){
// console.log(year+'年'+month+'月'+day+'日')
// console.log('是节假日')
isVacation = true
}
}
return false
}
})
}
})