@@ -243,7 +243,7 @@ public function month( $field ) {
243243 * zero month parts like '2020-00-15'. PHP's strtotime() can't
244244 * parse these, so we extract the month directly from the string.
245245 */
246- if ( preg_match ( '/\d{4}-(\d{2})/ ' , $ field , $ matches ) ) {
246+ if ( preg_match ( '/^ \d{4}-(\d{2})/ ' , $ field , $ matches ) ) {
247247 return intval ( $ matches [1 ] );
248248 }
249249 /*
@@ -267,7 +267,7 @@ public function year( $field ) {
267267 * MySQL returns 0 for YEAR('0000-00-00'). PHP's strtotime()
268268 * can't parse zero dates, so we extract the year directly.
269269 */
270- if ( preg_match ( '/(\d{4})-\d{2}/ ' , $ field , $ matches ) ) {
270+ if ( preg_match ( '/^ (\d{4})-\d{2}/ ' , $ field , $ matches ) ) {
271271 return intval ( $ matches [1 ] );
272272 }
273273 /*
@@ -291,7 +291,7 @@ public function day( $field ) {
291291 * zero day parts like '2020-01-00'. PHP's strtotime() can't
292292 * parse these, so we extract the day directly from the string.
293293 */
294- if ( preg_match ( '/\d{4}-\d{2}-(\d{2})/ ' , $ field , $ matches ) ) {
294+ if ( preg_match ( '/^ \d{4}-\d{2}-(\d{2})/ ' , $ field , $ matches ) ) {
295295 return intval ( $ matches [1 ] );
296296 }
297297 /*
0 commit comments