浏览代码

Merge pull request #4147 from datacompboy/patch-1

Fix ValidateDateTime: check day instead month
Adam Cozzette 7 年之前
父节点
当前提交
d4afdba83d
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/google/protobuf/stubs/time.cc

+ 2 - 2
src/google/protobuf/stubs/time.cc

@@ -80,9 +80,9 @@ bool ValidateDateTime(const DateTime& time) {
     return false;
     return false;
   }
   }
   if (time.month == 2 && IsLeapYear(time.year)) {
   if (time.month == 2 && IsLeapYear(time.year)) {
-    return time.month <= kDaysInMonth[time.month] + 1;
+    return time.day <= kDaysInMonth[time.month] + 1;
   } else {
   } else {
-    return time.month <= kDaysInMonth[time.month];
+    return time.day <= kDaysInMonth[time.month];
   }
   }
 }
 }