Loading ...
Sorry, an error occurred while loading the content.
 

Calendar min and max date in Safari

Expand Messages
  • cday87
    Has anyone had issues with the calendar in Safari not correctly setting the maximum date properly? I ve set the calendar max date to the current date +360.
    Message 1 of 3 , Mar 5 7:04 AM
      Has anyone had issues with the calendar in Safari not correctly
      setting the maximum date properly? I've set the calendar max date to
      the current date +360. Works fine on IE, FF and Opera, but on Safari
      the date only goes out about 100 days.

      // Calendar code
      var currentDate = new Date();
      var minDate = new Date();
      minDate.setDate(currentDate.getDate() - 1);
      var maxDate = new Date();
      maxDate.setYear(currentDate.getYear() + 360);
      var selectedDate = parseDate
      (document.fareInformationForm.departDate.value, "${principal.user.pref
      erredDateFormat}");

      var selectedMonth = ((selectedDate.getMonth()+1) + "/" +
      selectedDate.getFullYear());
      var selectedDateString = ((selectedDate.getMonth()+1) + "/" +
      selectedDate.getDate() + "/" + selectedDate.getFullYear());

      // Create the calendar object
      if(navigator.userAgent.indexOf("Opera") != -1) {
      // Opera has bugs, just making a calendar item, not a group

      var cal1 = new YAHOO.widget.Calendar
      ("departDate", "departDateContainer", {pagedate:selectedMonth,
      selected:selectedDateString, mindate:minDate, maxdate:maxDate,
      title:"Depart date", close:true} );

      }
      else {

      var cal1 = new YAHOO.widget.CalendarGroup
      ("departDate", "departDateContainer", {pagedate:selectedMonth,
      selected:selectedDateString, mindate:minDate, maxdate:maxDate,
      title:"Depart date", close:true} );

      }
      cal1.render();
    • cday87
      Hah! Found it (http://www.quirksmode.org/bugreports/archives/safari/index.html)! Saf ari s Date.setDate() function appears to be limited to a single byte
      Message 2 of 3 , Mar 5 7:30 AM
        Hah! Found it
        (http://www.quirksmode.org/bugreports/archives/safari/index.html)! "Saf
        ari's Date.setDate() function appears to be limited to a single byte
        number, making the range of date changes between -128 and 127."
      • Satyen Desai
        Hi, As of YUI 2.5.0: YAHOO.widget.DateMath.add(date, YAHOO.widget.DateMath.DAYS, xDays) Should take care of this cross-browser variance for you. Let me know if
        Message 3 of 3 , Mar 5 12:36 PM
          Hi,

          As of YUI 2.5.0:

          YAHOO.widget.DateMath.add(date, YAHOO.widget.DateMath.DAYS, xDays)

          Should take care of this cross-browser variance for you. Let me know if
          you find it doesn't.

          Regards,
          Satyen
        Your message has been successfully submitted and would be delivered to recipients shortly.