You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

预订日历单日预订无法正常标记已占用的Bug修复求助

预订日历单日预订无法正常标记已占用的Bug修复求助

我现在卡在一个预订日历的Bug上,怎么都搞不定:当用户只预订单日时,这个日期不会被标记为已占用——也就是说其他用户看到这个日期还是可预订状态,没有像其他已预订日期那样被划掉(比如10号本该和其他已订日期一样被标记,但实际没有)。

以下是我的原始代码:

function wpkGetThisDateSlots( date ) {

var slots = {

isFirstSlotTaken: false,

isSecondSlotTaken: false

}

if ( $( '#listing_type' ).val() == 'event' )

return slots;

if ( typeof disabledDates !== 'undefined' ) {

if ( wpkIsDateInArray( date, disabledDates ) ) {

slots.isFirstSlotTaken = slots.isSecondSlotTaken = true;

return slots;

}

}

if ( typeof wpkStartDates != 'undefined' && typeof wpkEndDates != 'undefined' ) {

slots.isSecondSlotTaken = wpkIsDateInArray( date, wpkStartDates );

slots.isFirstSlotTaken = wpkIsDateInArray( date, wpkEndDates );

}

//console.log(slots);

return slots;

}

function wpkIsDateInArray( date, array ) {

return jQuery.inArray( date.format("YYYY-MM-DD"), array ) !== -1;

}

我试过加了这么一段判断,但完全没效果:

if ( typeof wpkStartDates == typeof wpkEndDates) {

}

有没有大佬能帮我看看问题出在哪?怎么才能让单日预订的日期正常被标记为已占用?

备注:内容来源于stack exchange,提问作者polish_prince

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.22 13:35:31