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

Double Digit Day Picker

Expand Messages
  • lindquistjc
    I am trying to get the days on the calendar to act as a link to various pages. For instance, clicking on October 12th would take you to the following url:
    Message 1 of 3 , Oct 9, 2007
    • 0 Attachment
      I am trying to get the days on the calendar to act as a link to various
      pages. For instance, clicking on October 12th would take you to the
      following url: http://s196272708.onlinehome.us/misc/2001/oct/12/ .

      I used the below code form the YUI example. Everything works well
      except when it comes to single digit days. I can't figure out how to
      include a "0" infront of days that only have one digit. Without
      the "0", the links do not work.


      var mySelectHandler = function(type,args,obj) {
      var dates = args[0];
      var date = dates[0];
      var year = date[0], month = date[1], day = date[2];
      var months =
      ['','jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','d
      ec'];
      var monthString = months[month];
      window.location = "http://s196272708.onlinehome.us/misc/" + year
      + "/" + monthString + "/" + day +"/";

      };

      Any help would be appreciated.

      Thanks,

      J
    • krisheehaw
      function padDay(day){ if (day
      Message 2 of 3 , Oct 9, 2007
      • 0 Attachment
        function padDay(day){
        if (day < 10){
        return "0"+day;
        } else {
        return day;
        }
        }


        --- In ydn-javascript@yahoogroups.com, "lindquistjc" <phblthp@...> wrote:
        >
        > I am trying to get the days on the calendar to act as a link to various
        > pages. For instance, clicking on October 12th would take you to the
        > following url: http://s196272708.onlinehome.us/misc/2001/oct/12/ .
        >
        > I used the below code form the YUI example. Everything works well
        > except when it comes to single digit days. I can't figure out how to
        > include a "0" infront of days that only have one digit. Without
        > the "0", the links do not work.
        >
        >
        > var mySelectHandler = function(type,args,obj) {
        > var dates = args[0];
        > var date = dates[0];
        > var year = date[0], month = date[1], day = date[2];
        > var months =
        > ['','jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','d
        > ec'];
        > var monthString = months[month];
        > window.location = "http://s196272708.onlinehome.us/misc/" + year
        > + "/" + monthString + "/" + day +"/";
        >
        > };
        >
        > Any help would be appreciated.
        >
        > Thanks,
        >
        > J
        >
      • krisheehaw
        in fact, to optimise it somewhat: window.location = http://s196272708.onlinehome.us/misc/ + year + / + month + / + (((day
        Message 3 of 3 , Oct 9, 2007
        • 0 Attachment
          in fact, to optimise it somewhat:

          window.location = "http://s196272708.onlinehome.us/misc/" + year
          + "/" + month + "/" + (((day <10)? "0":"") + day) +"/";

          --- In ydn-javascript@yahoogroups.com, "krisheehaw" <krisheehaw@...>
          wrote:
          >
          > function padDay(day){
          > if (day < 10){
          > return "0"+day;
          > } else {
          > return day;
          > }
          > }
          >
          >
          > --- In ydn-javascript@yahoogroups.com, "lindquistjc" <phblthp@> wrote:
          > >
          > > I am trying to get the days on the calendar to act as a link to
          various
          > > pages. For instance, clicking on October 12th would take you to the
          > > following url: http://s196272708.onlinehome.us/misc/2001/oct/12/ .
          > >
          > > I used the below code form the YUI example. Everything works well
          > > except when it comes to single digit days. I can't figure out how to
          > > include a "0" infront of days that only have one digit. Without
          > > the "0", the links do not work.
          > >
          > >
          > > var mySelectHandler = function(type,args,obj) {
          > > var dates = args[0];
          > > var date = dates[0];
          > > var year = date[0], month = date[1], day = date[2];
          > > var months =
          > >
          ['','jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','d
          > > ec'];
          > > var monthString = months[month];
          > > window.location = "http://s196272708.onlinehome.us/misc/" + year
          > > + "/" + monthString + "/" + day +"/";
          > >
          > > };
          > >
          > > Any help would be appreciated.
          > >
          > > Thanks,
          > >
          > > J
          > >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.