- $month = $this->mMonth + 1;
- // For December, we want January 1 of the next year
+ $month = $this->mMonth;
+
+ // Day validity check after we have month and year checked
+ $this->mDay = checkdate( $month, $day, $year ) ? $day : false;
+
+ if ( $this->mDay ) {
+ // If we have a day, we want up to the day immediately afterward
+ $day = $this->mDay + 1;
+
+ // Did we overflow the current month?
+ if ( !checkdate( $month, $day, $year ) ) {
+ $day = 1;
+ $month++;
+ }
+ } else {
+ // If no day, assume beginning of next month
+ $day = 1;
+ $month++;
+ }
+
+ // Did we overflow the current year?