@@ -102,8 +102,9 @@ public static function thisMonth()
102
102
*/
103
103
public static function lastMonth ()
104
104
{
105
- $ start = mktime (0 , 0 , 0 , (int )date ('m ' ) - 1 , 1 , (int )date ('Y ' ));
106
- $ end = mktime (23 , 59 , 59 , (int )date ('m ' ) - 1 , (int )date ('t ' ), (int )date ('Y ' ));
105
+ $ year = (int )date ('Y ' );
106
+ $ start = mktime (0 , 0 , 0 , (int )date ('m ' ) - 1 , 1 ,$ year );
107
+ $ end = mktime (23 , 59 , 59 , (int )date ('m ' ) - 1 , (int )date ('t ' ,$ start ), $ year );
107
108
108
109
if (date ('m ' , $ start ) != date ('m ' , $ end )) {
109
110
$ end -= 60 * 60 * 24 ;
@@ -123,8 +124,9 @@ public static function lastMonth()
123
124
*/
124
125
public static function monthsAgo ($ month )
125
126
{
126
- $ start = mktime (0 , 0 , 0 , (int )date ('m ' ) - $ month , 1 , (int )date ('Y ' ));
127
- $ end = mktime (23 , 59 , 59 , (int )date ('m ' ) - $ month , (int )date ('t ' ), (int )date ('Y ' ));
127
+ $ year = (int )date ('Y ' );
128
+ $ start = mktime (0 , 0 , 0 , (int )date ('m ' ) - $ month , 1 , $ year );
129
+ $ end = mktime (23 , 59 , 59 , (int )date ('m ' ) - $ month , (int )date ('t ' ,$ start ), $ year );
128
130
if (date ('m ' , $ start ) != date ('m ' , $ end )) {
129
131
$ end -= 60 * 60 * 24 ;
130
132
}
0 commit comments