diff --git a/src/zscanner/scanner_functions.c b/src/zscanner/scanner_functions.c
index 3b16660201bc0e921c1a815a8527ab49145ab605..a0c0ca9b2cd185202c24211d20f94e0c4ef3dbb5 100644
--- a/src/zscanner/scanner_functions.c
+++ b/src/zscanner/scanner_functions.c
@@ -752,7 +752,7 @@ int date_to_timestamp(uint8_t *buff, uint32_t *timestamp)
     }
 
     if (is_leap_year[year]) {
-        if (day > 2) {
+        if (month > 2) {
             leap_day = 1; // Add one day in case of leap year.
         }
         else if (month == 2 && day > (days_in_months[month] + 1)) {