]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix a bug in when
authorGeorg Ehrke <dev@georgswebsite.de>
Sat, 9 Jun 2012 13:14:49 +0000 (15:14 +0200)
committerGeorg Ehrke <dev@georgswebsite.de>
Sat, 9 Jun 2012 13:15:00 +0000 (15:15 +0200)
3rdparty/when/When.php

index 5f97f0eb9bf3ed4e8c7a351efbf9f0e1684250c9..185836bf0c5bff6516d67991c42aace0f80ca24b 100644 (file)
@@ -586,7 +586,7 @@ class When
                                }
                        }
                }
-               elseif($this->gobyday || $interval == "month")
+               elseif($this->gobyday && $interval == "month")
                {
                        $_mdays = range(1, date('t',mktime(0,0,0,$month,1,$year)));
                        foreach($_mdays as $_mday)
@@ -621,7 +621,13 @@ class When
                
                if($interval == "month")
                {
-                       $this->try_date->modify('last day of ' . $this->interval . ' ' . $interval);
+                       
+                       $this->try_date->modify('first day of next month');
+                       if((int) date('t', $this->try_date->format('U')) > (int) $this->start_date->format('j')){
+                               $this->try_date->modify('+' . (int) $this->start_date->format('j') - 1 . ' day'); 
+                       }else{
+                               $this->try_date->modify('+' . (int) date('t', $this->try_date->format('U')) - 1 . ' day'); 
+                       }
                }
                else
                {
@@ -722,4 +728,4 @@ class When
                        }
                }
        }
-}
+}
\ No newline at end of file