[gnumeric] DATE: saner patch.
- From: Morten Welinder <mortenw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnumeric] DATE: saner patch.
- Date: Fri, 23 Oct 2009 14:16:23 +0000 (UTC)
commit 038946848db3060b236f0afc8d6b25c47f379a8b
Author: Morten Welinder <terra gnome org>
Date: Fri Oct 23 10:16:09 2009 -0400
DATE: saner patch.
plugins/fn-date/functions.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/plugins/fn-date/functions.c b/plugins/fn-date/functions.c
index 9782954..3703a2f 100644
--- a/plugins/fn-date/functions.c
+++ b/plugins/fn-date/functions.c
@@ -97,8 +97,10 @@ gnumeric_date (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
if (year < 0 || year >= 10000)
goto error;
- if (year < 1000) /* Excel uses 1900 -- ick! */
- year += 1900;
+ if (!gnm_datetime_allow_negative () && year < 1900)
+ year += 1900; /* Excel compatibility. */
+ else if (year < 1000)
+ year += 1900; /* Somewhat more sane. */
/* This uses floor and not trunc on purpose. */
month = gnm_floor (month);
@@ -117,7 +119,9 @@ 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) < 1582 ||
+ g_date_get_year (&date) < (gnm_datetime_allow_negative ()
+ ? 1582
+ : go_date_convention_base (conv)) ||
g_date_get_year (&date) >= 11900)
goto error;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]