如何使过去的日期在fullcalendar中不可选? [英] How to make past date unselectable in fullcalendar?

查看:2902
本文介绍了如何使过去的日期在fullcalendar中不可选?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是,如何在全日制的月/周视图中禁用在PAST DATES上的可选择。



我希望用户不能点击/选择过去的日期。





以下是我在事件呈现中实现的一些Google格式的代码段:

 可选:true,
selectHelper:false,
select:function(start,end,allDay){
var appdate = jQuery.datepicker.formatDate('<? php echo $ DPFormat;?>',new Date(start));
jQuery('#appdate')。val(appdate);
jQuery('#AppFirstModal')。show();
},
eventRender:function(event,element,view)
{
var view ='month';
if(event.start.getMonth()!== view.start.getMonth()){return false;
},

但它不工作。



我也尝试过bel CSS,这有助于我隐藏过去的日期文本,但可选择仍然在过期的框中。

  .fc-other-month .fc-day-number {
display:none;
}

我真的坚持这个问题。请有人帮我出去
谢谢...

解决方案

我已经在我的fullcalendar中完成了这个工作,它的工作完美。 b
$ b

您可以在选择功能中添加此代码。

  select:function(start, end,allDay){
var check = $ .fullCalendar.formatDate(start,'yyyy-MM-dd');
var today = $ .fullCalendar.formatDate(new Date(),'yyyy-MM-dd');
if(check< today)
{
//上一天。显示消息,如果你想要什么也不做。
//所以它将是unselectable
}
else
{
//它的一个正确的日期
//做某事
}
},

我希望它会帮助你。


Problem is, how to disable selectable on PAST DATES in fullcalendar's month/week view.

I want to user not allowed to click/select the on past dates.

Here is some googled code snippet I am trying to implement on event rendering:

selectable: true,
selectHelper: false,
select: function(start, end, allDay) {
        var appdate = jQuery.datepicker.formatDate('<?php echo $DPFormat; ?>', new Date(start));
        jQuery('#appdate').val(appdate);
        jQuery('#AppFirstModal').show();
    },
    eventRender: function(event, element, view)
    {
        var view = 'month' ;
       if(event.start.getMonth() !== view.start.getMonth()) { return false; }
    },

But its not working though.

I tried bellow CSS too and this help me to hide past date text only, but selectable is still working on pastdate box.

.fc-other-month .fc-day-number {
     display:none;
}

I am really stuck with this problem. Please someone help me out. Thanks...

解决方案

I have done this in my fullcalendar and it's working perfectly.

you can add this code in your select function.

 select: function(start, end, allDay) {
    var check = $.fullCalendar.formatDate(start,'yyyy-MM-dd');
    var today = $.fullCalendar.formatDate(new Date(),'yyyy-MM-dd');
    if(check < today)
    {
        // Previous Day. show message if you want otherwise do nothing.
        // So it will be unselectable
    }
    else
    {
        // Its a right date
        // Do something
    }
  },

I hope it will help you.

这篇关于如何使过去的日期在fullcalendar中不可选?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆