diff --git a/libexslt/date.c b/libexslt/date.c
index 9ca993c..fd9d772 100644
--- a/libexslt/date.c
+++ b/libexslt/date.c
@@ -185,8 +185,8 @@ static const unsigned long dayInLeapYearByMonth[12] =
 
 #define DAY_IN_YEAR(day, month, year)				\
         ((IS_LEAP(year) ?					\
-                dayInLeapYearByMonth[month - 1] :		\
-                dayInYearByMonth[month - 1]) + day)
+                dayInLeapYearByMonth[month < 1 ? 0 : month - 1] :	\
+                dayInYearByMonth[month < 1 ? 0 : month - 1]) + day)
 
 /**
  * _exsltDateParseGYear:
