Changeset 3279

Show
Ignore:
Timestamp:
08/06/2008 09:41:49 AM (4 months ago)
Author:
Shadowhand
Message:

Finally fixed #632, thanks dyron!

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/libraries/Calendar.php

    r3186 r3279  
    221221                $month = $week = array(); 
    222222 
    223                 // Number of days added. When this reaches 7, start a new month 
     223                // Number of days added. When this reaches 7, start a new week 
    224224                $days = 0; 
    225225                $week_number = 1; 
    226226 
    227                 if (($w = (int) date('w', $first)) > $this->week_start) 
     227                if (($w = (int) date('w', $first) - $this->week_start) < 0) 
     228                { 
     229                        $w = 6; 
     230                } 
     231 
     232                if ($w > 0) 
    228233                { 
    229234                        // Number of days in the previous month 
     
    231236 
    232237                        // i = number of day, t = number of days to pad 
    233                         for ($i = $n - $w + $this->week_start + 1, $t = $w - $this->week_start; $t > 0; $t--, $i++) 
     238                        for ($i = $n - $w + 1, $t = $w; $t > 0; $t--, $i++) 
    234239                        { 
    235240                                // Notify the listeners 
     
    262267                } 
    263268 
    264                 if (($w = (int) date('w', $last) - $this->week_start) < 6 AND $w > -1) 
     269                if (($w = (int) date('w', $last) - $this->week_start) < 0) 
     270                { 
     271                        $w = 6; 
     272                } 
     273 
     274                if ($w >= 0) 
    265275                { 
    266276                        // i = number of day, t = number of days to pad