On Friday, January 31, 2014 11:34:32 AM UTC+5:30, Danielo Rodríguez wrote:
>
> Hello
>
> I'm triying to do some kind of journal. So I wrote a macro that displays 
> every month as a table. I don't understand why every month is displayed 
> correctly except for June. In fact, June is only displayed incorrectly if 
> it has other month immediately above. If it is the first or stand alone, it 
> is displayed properly.
>
> If you want to check the code enter to  http://braintest.tiddlyspot.com/and 
> look for TestMonth.
> Thanks in advance.
> Kind regards.
>

Hi Danielo,



note that Calendar.getDay() returns 0-6 and that DAYS_OF_WEEK is 7.
your code should be more like this I think:

// loops for each day in the calendar
for(index=0; index < DAYS_OF_MONTH; index++)
{
    if( Calendar.getDate() > index )
    {
              // returns the next day to print
              var week_day =Calendar.getDay();
             
              // start the next new row for the first day of the week
              //if(week_day == 0)
              //cal += lf + col;
             
          //if(week_day != DAYS_OF_WEEK)
          {
         
              // set the variable which is inside the loop for incrementing
              var day  = Calendar.getDate();
             
              // highlight today's date
              if( today==Calendar.getDate() )
              cal += '!' + spa + day + makeLink(day) + spa +col;
             
              // prints day
              else
              cal += spa + day + makeLink(day) + spa +col;
          }
         
          // end row for last day of the week
          if(week_day == DAYS_OF_WEEK-1)
            cal += lf + col;
      
    }
     
      // increments until the end of the month
      Calendar.setDate(Calendar.getDate()+1);
 
}// end for loop

BJ

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to