Index: tol/bbasic/dtealgeb.cpp
===================================================================
--- tol/bbasic/dtealgeb.cpp	(revision c300cb7c46687b514a44cc3ab336dcb40b86332f)
+++ tol/bbasic/dtealgeb.cpp	(revision bb3467ee7fbcdcfe6ceb36a13e8bd999767f6a09)
@@ -473,5 +473,7 @@
   BInt days;
   BInt rest, i;
-  if(!HasValue()) { return(year_*366); }
+  if(*this==begin_) { return(-115782); }
+  if(*this==end_) { return(219147); }
+  if(!HasValue()) { return(2147483647); }
 
   days = (year_ / 400) * DAYSCICLE400;
Index: tol/btol/real_type/datgrav.cpp
===================================================================
--- tol/btol/real_type/datgrav.cpp	(revision c300cb7c46687b514a44cc3ab336dcb40b86332f)
+++ tol/btol/real_type/datgrav.cpp	(revision bb3467ee7fbcdcfe6ceb36a13e8bd999767f6a09)
@@ -373,5 +373,9 @@
   void BDatDateToIndex::CalcContens()
 //--------------------------------------------------------------------
-{ contens_ = Date(Arg(1)).Index(); }
+{ 
+  BDate& dte = Date(Arg(1));
+  int dayIdx = dte.DayIndex(); 
+  if(dayIdx!=2147483647) { contens_ = dte.Index(); }
+}
 
 
