summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarlinsandbulte2011-02-11 11:18:30 (GMT)
committer arlinsandbulte2011-02-11 11:18:30 (GMT)
commitcff5997cce44d6bdf5938321bcf1a7f9e105e555 (patch)
tree24f35a3d9c3f82450b5a18e0a7c8cebf361c44ef
parent678da84d00d76364660bc720380942bec5dd0961 (diff)
#1047412 by das-peter - Using date filter in February causes "The day is invalid" error.
-rw-r--r--date_api/date_api.module5
1 files changed, 4 insertions, 1 deletions
diff --git a/date_api/date_api.module b/date_api/date_api.module
index 8b61c47..fecd68d 100644
--- a/date_api/date_api.module
+++ b/date_api/date_api.module
@@ -582,10 +582,13 @@ class DateObject extends DateTime {
public function arrayErrors($arr) {
$errors = array();
$now = date_now();
+ $default_month = !empty($arr['month']) ? $arr['month'] : $now->format('n');
+ $default_year = !empty($arr['year']) ? $arr['year'] : $now->format('Y');
+
foreach ($arr as $part => $value) {
// Avoid false errors when a numeric value is input as a string by forcing it numeric.
$value = intval($value);
- if (!empty($value) && $this->forceValid($part, $value, 'now', $now->format('n'), $now->format('Y')) != $value) {
+ if (!empty($value) && $this->forceValid($part, $value, 'now', $default_month, $default_year) != $value) {
// Use a switchcase to make translation easier by providing a different message for each part.
switch($part) {
case 'year':