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

Re: Configure Calendar to Display Alterndate Date as 'Current Date'

Expand Messages
  • gkcdn74
    John, Thanks for the help, it worked like a charm! I did make a slight modification however to ensure that the calendar loads on the same page as the newly
    Message 1 of 3 , Aug 5, 2009
    • 0 Attachment
      John,

      Thanks for the help, it worked like a charm!

      I did make a slight modification however to ensure that the calendar loads on the same page as the newly rendered 'today' cell.

      var d = YAHOO.widget.DateMath.subtract(new Date(), YAHOO.widget.DateMath.DAY, 13),
      m = (d.getMonth()+1) + '/' + d.getFullYear();

      var myCal = new YAHOO.widget.Calendar(myCal,{pagedate:m});

      myCal._renderCellStyleToday = myCal.renderCellStyleToday;
      myCal.renderCellStyleToday = function() {};

      s = (d.getMonth()+1) + '/' + d.getDate() + '/' + d.getFullYear();

      myCal.addRenderer(s, myCal._renderCellStyleToday);
      myCal.render();

      Otherwise the page would load showing the current month rather than the Julian month/year which could be different depending on the current date(ie the 1st thru the 13th of each month)

      Best Regards,
      Stavros

      --- In ydn-javascript@yahoogroups.com, "theblargoner" <theblargoner@...> wrote:
      >
      > You could hack the render stack to do what you want, something like:
      >
      > var myCal = new YAHOO.widget.Calendar(...);
      >
      > myCal._renderCellStyleToday = myCal.renderCellStyleToday;
      > myCal.renderCellStyleToday = function() {};
      >
      > var d = YAHOO.widget.DateMath.subtract(new Date(), YAHOO.widget.DateMath.DAY, 13),
      > s = (d.getMonth()+1) + '/' + d.getDate() + '/' + d.getFullYear();
      >
      > myCal.addRenderer(s, myCal._renderCellStyleToday);
      > myCal.render();
      >
      > This will give the day 13 days prior to the current day the 'today' style.
      >
      > John
      >
      > --- In ydn-javascript@yahoogroups.com, "gkcdn74" <gkcdn74@> wrote:
      > >
      > > Hi,
      > >
      > > By default the calendar is configured to display the current date through CSS of td.calcell.today. However, I'm working on a project for which I would like the calendar to display an alternate date based on a specific offset (ie 13 days in the past from the current date).
      > >
      > > For exmaple: If the current date is Aug 5, 2009 I would like the calendar to display July 23, 2009 as the 'current date' instead
      > >
      > > Is there a way to modify td.calcell.today to point 13 days in the past? Any alternate solution?
      > >
      > > Basically, I'm trying to modify the calendar to appear as though it is functioning according to the Julian Calendar which has a 13day offset from the current day Gregorian Calendar.
      > >
      > > Thanks in advance,
      > > Stavros
      > >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.