SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Oct 2006
    Posts
    216
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    newb: jsCalendar Question

    Anyone know how to disable the previous days from current day, in jsCalendar?

    Also, how do you set the date rage to start from the current time to current time + 90 days?

    I do not want to hard code the date ranges, but dynamically change them. So the start_date would be:current day and end_date would be: current day + 90 days.

  2. #2
    SitePoint Addict jtrelfa's Avatar
    Join Date
    Oct 2004
    Location
    Troy, Mi
    Posts
    231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're going to have to provide more detail. There's more than one "jsCalendar" and we'll need a URL or some code or an image or something that helps us figure out what you're trying to do.
    var me = null;

  3. #3
    SitePoint Addict
    Join Date
    Oct 2006
    Posts
    216
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is my code and url for the jsCalendar.

    http://www.dynarch.com/projects/calendar/

    <script type="text/javascript">
    function AddMonths() {
    var todayInMS = today.getTime()
    var Future3MonthsInMS = todayInMS + (60 * 60 * 24 * (7 * 4 * 3) * 1000)
    return new Date(Future3MonthsInMS)
    }

    function dateStatus(date) {
    var min = new Date();
    var max = AddMonths();
    if (date.getTime() < min.getTime() ||
    date.getTime() > max.getTime())
    return true; // true says "disable"
    else
    return false; // leave other dates enabled
    }

    Calendar.setup({
    inputField : "id_appointment_at", //*
    ifFormat : "%Y-%m-%d %H:%M",
    showsTime : true,
    timeFormat : "24",
    button : "id_appointment_at_img", //*
    step : 1
    dateStatusFunc : dateStatus
    });
    </script>

  4. #4
    SitePoint Addict jtrelfa's Avatar
    Join Date
    Oct 2004
    Location
    Troy, Mi
    Posts
    231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It looks to me like you're on the right track. After a (brief) look at the provided docs and examples, the dateStatusFunc property allows you to tell the program what dates to disable.

    The only "range" feature provided by the calendar is a Year range as opposed to a specific number of days. You'll have to prototype whatever part of the object checks for the range and modify it yourself.
    var me = null;


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •