[gnumeric] DATE: fix handling of pre-1900 dates.



commit 161c30c80af11ffc399e55a26f69b3346b97874c
Author: Morten Welinder <terra gnome org>
Date:   Fri Oct 23 09:53:05 2009 -0400

    DATE: fix handling of pre-1900 dates.

 NEWS                        |    1 +
 plugins/fn-date/ChangeLog   |    5 +++++
 plugins/fn-date/functions.c |    4 ++--
 3 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index 2946703..da0f1ea 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,7 @@ Morten:
 	* Save and read new arrow attributes in xml format.
 	* Fix Excel-to-Gnumeric paste problem.  [#381732, #388531].
 	* Fix Alt-Enter problems.  [#597295]
+	* Make DATE work for pre-1900 dates.  [#599365]
 
 Yaacov Zamir:
        * Hebrew Calendar functions.  [#153738]
diff --git a/plugins/fn-date/ChangeLog b/plugins/fn-date/ChangeLog
index 0c9ee58..52c33b6 100644
--- a/plugins/fn-date/ChangeLog
+++ b/plugins/fn-date/ChangeLog
@@ -1,3 +1,8 @@
+2009-10-23  Morten Welinder  <terra gnome org>
+
+	* functions.c (gnumeric_date): Improve support for pre-1900 dates
+	as the expense of obscure XL compatibility.
+
 2009-10-11  Morten Welinder <terra gnome org>
 
 	* Release 1.9.14
diff --git a/plugins/fn-date/functions.c b/plugins/fn-date/functions.c
index 3bb1a4a..9782954 100644
--- a/plugins/fn-date/functions.c
+++ b/plugins/fn-date/functions.c
@@ -97,7 +97,7 @@ gnumeric_date (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 	if (year < 0 || year >= 10000)
 		goto error;
-	if (year < 1900) /* 1900, not 100.  Ick!  */
+	if (year < 1000) /* Excel uses 1900 -- ick!  */
 		year += 1900;
 
 	/* This uses floor and not trunc on purpose.  */
@@ -117,7 +117,7 @@ gnumeric_date (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 	gnm_date_add_days (&date, (int)day - 1);
 
 	if (!g_date_valid (&date) ||
-	    g_date_get_year (&date) < go_date_convention_base (conv) ||
+	    g_date_get_year (&date) < 1582 ||
 	    g_date_get_year (&date) >= 11900)
 		goto error;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]