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

Bug in constructor calendar with months "08/2006" and "09/2006"

Expand Messages
  • johnymaracas
    Hi, I ve used the calendar with the code: var avui = new Date(); m = avui.getMonth(); d = avui.getDate(); y = avui.getFullYear(); var resDate =
    Message 1 of 4 , Aug 2, 2006
    • 0 Attachment
      Hi,

      I've used the calendar with the code:

      var avui = new Date();
      m = avui.getMonth();
      d = avui.getDate();
      y = avui.getFullYear();
      var resDate = (m+1)+"/"+d+"/"+y;

      var minDate = new Date(2006,5,27);
      var maxDate = YAHOO.widget.DateMath.add(new Date(), YAHOO.widget.DateMath.DAY, 0);

      c1 = new YAHOO.widget.Calendar("c1","c1Cont","08/2006","07/26/2006-08/01/2006");
      c1.minDate = minDate;
      c1.maxDate = maxDate;
      c1.addRenderer(resDate, c1.renderBodyCellRestricted);
      c1.onSelect = setDate1;
      c1.render();


      The problem is when the calendar is loaded shows "December 2005" instead of  "August 2006".
      After searhing I've found the message 1750:

      hi, just a hint on a rather well-known js pitfall:

      if you enter as a monthyear "08/2006" or "09/2006" asa an arg to the
      Calendar constructor, you will get unexpected results.

      this is due to js interpreting 08 (09) as octal number and therefore
      the parseInt in YAHOO.widget.Calendar_Core.prototype.init will deliver
      decimal 0 (1).

      i think this is a bug of yui and the parseInt's should be replaced for
      parseInt's using explicit radix 10.

      greetings, daniel.


      But nobody answered and the bug still remains.
    • Steven Peterson
      I seem to recall replying to this message. 08/2006 and 09/2006 are not valid formats for the Calendar. The Calendar doesn t accept zero-padding for date
      Message 2 of 4 , Aug 2, 2006
      • 0 Attachment

        I seem to recall replying to this message. “08/2006” and “09/2006” are not valid formats for the Calendar. The Calendar doesn’t accept zero-padding for date fields, so you should use “8/2006” and “9/2006”. Let me know if your problems continue after correcting the format.

         

        Thanks!

        Steven Peterson

        Web Developer, Platform Engineering

        Yahoo!

         

         

        From: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com] On Behalf Of johnymaracas
        Sent: Wednesday, August 02, 2006 2:47 AM
        To: ydn-javascript@yahoogroups.com
        Subject: [ydn-javascript] Bug in constructor calendar with months "08/2006" and "09/2006"

         

        Hi,

        I've used the calendar with the code:

        var avui = new Date();
        m = avui.getMonth();
        d = avui.getDate();
        y = avui.getFullYear();
        var resDate = (m+1)+"/"+d+"/"+y;

        var minDate = new Date(2006,5,27);
        var maxDate = YAHOO.widget.DateMath.add(new Date(), YAHOO.widget.DateMath.DAY, 0);

        c1 = new YAHOO.widget.Calendar("c1","c1Cont",
        "08/2006","07/26/2006-08/01/2006");
        c1.minDate = minDate;
        c1.maxDate = maxDate;
        c1.addRenderer(resDate, c1.renderBodyCellRestricted);
        c1.onSelect = setDate1;
        c1.render();


        The problem is when the calendar is loaded shows "December 2005" instead of  "August 2006".
        After searhing I've found the message 1750:

        hi, just a hint on a rather well-known js pitfall:

        if you enter as a monthyear "08/2006" or "09/2006" asa an arg to the
        Calendar constructor, you will get unexpected results.

        this is due to js interpreting 08 (09) as octal number and therefore
        the parseInt in YAHOO.widget.Calendar_Core.prototype.init will deliver
        decimal 0 (1).

        i think this is a bug of yui and the parseInt's should be replaced for
        parseInt's using explicit radix 10.

        greetings, daniel.


        But nobody answered and the bug still remains.

      • Douglas Crockford
        ... zero-padding for ... your ... I think that you should accept the 08/2006 format.
        Message 3 of 4 , Aug 2, 2006
        • 0 Attachment
          --- In ydn-javascript@yahoogroups.com, "Steven Peterson"
          <peterson@...> wrote:
          >
          > "08/2006" and "09/2006" are not
          > valid formats for the Calendar. The Calendar doesn't accept
          zero-padding for
          > date fields, so you should use "8/2006" and "9/2006". Let me know if
          your
          > problems continue after correcting the format.


          I think that you should accept the "08/2006" format.
        • johnymaracas
          It works! I misunderstood the documentation. May be in the calendar documentation (http://developer.yahoo.com/yui/calendar/#start) in Initializing the
          Message 4 of 4 , Aug 3, 2006
          • 0 Attachment
            It works!

            I misunderstood the documentation.

            May be in the calendar documentation (http://developer.yahoo.com/yui/calendar/#start) in "Initializing the Calendar"
            should include an example:

            Where:

            • id is the ID that should be assigned to the Calendar instance's table element (the table will be created by the Calendar instance when it is rendered);
            • containerId is the id of the HTML element where the calendar will be inserted;
            • monthyear is the month/year (MM/YYYY) string used to set the current calendar page;  Ex: "1/2006", "10/2006"
            • selected is a string of date values formatted using the date parser.
            Because the constructor works with all months ("01/2006","02/2006",...)  except "08" and "09".

            Thank you!


            --- In ydn-javascript@yahoogroups.com, "Steven Peterson" <peterson@...> wrote:
            >
            > I seem to recall replying to this message. "08/2006" and "09/2006" are not
            > valid formats for the Calendar. The Calendar doesn't accept zero-padding for
            > date fields, so you should use "8/2006" and "9/2006". Let me know if your
            > problems continue after correcting the format.
            >
            >
            >
            > Thanks!
            >
            > Steven Peterson
            >
            > Web Developer, Platform Engineering
            >
            > Yahoo!
            >
            >
            >
            >
            >
            > From: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com]
            > On Behalf Of johnymaracas
            > Sent: Wednesday, August 02, 2006 2:47 AM
            > To: ydn-javascript@yahoogroups.com
            > Subject: [ydn-javascript] Bug in constructor calendar with months "08/2006"
            > and "09/2006"
            >
            >
            >
            > Hi,
            >
            > I've used the calendar with the code:
            >
            > var avui = new Date();
            > m = avui.getMonth();
            > d = avui.getDate();
            > y = avui.getFullYear();
            > var resDate = (m+1)+"/"+d+"/"+y;
            >
            > var minDate = new Date(2006,5,27);
            > var maxDate = YAHOO.widget.DateMath.add(new Date(),
            > YAHOO.widget.DateMath.DAY, 0);
            >
            > c1 = new
            > YAHOO.widget.Calendar("c1","c1Cont","08/2006","07/26/2006-08/01/2006");
            > c1.minDate = minDate;
            > c1.maxDate = maxDate;
            > c1.addRenderer(resDate, c1.renderBodyCellRestricted);
            > c1.onSelect = setDate1;
            > c1.render();
            >
            > The problem is when the calendar is loaded shows "December 2005" instead of
            > "August 2006".
            > After searhing I've found the message 1750:
            >
            > hi, just a hint on a rather well-known js pitfall:
            >
            > if you enter as a monthyear "08/2006" or "09/2006" asa an arg to the
            > Calendar constructor, you will get unexpected results.
            >
            > this is due to js interpreting 08 (09) as octal number and therefore
            > the parseInt in YAHOO.widget.Calendar_Core.prototype.init will deliver
            > decimal 0 (1).
            >
            > i think this is a bug of yui and the parseInt's should be replaced for
            > parseInt's using explicit radix 10.
            >
            > greetings, daniel.
            >
            > But nobody answered and the bug still remains.

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