aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-06-20 19:57:48 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-06-30 00:42:30 +0800
commit876befb7b17f99d6baf2d6dfb42e8f3f64af93ff (patch)
tree676b139fd5529328f28b2e59cc5d8a3b3019f30a
parent79c3d4971021ed969550af58e3cdb1f6b6e29713 (diff)
downloadgsoc2013-evolution-876befb7b17f99d6baf2d6dfb42e8f3f64af93ff.tar.gz
gsoc2013-evolution-876befb7b17f99d6baf2d6dfb42e8f3f64af93ff.tar.zst
gsoc2013-evolution-876befb7b17f99d6baf2d6dfb42e8f3f64af93ff.zip
Bug #269413 - Search treats "4 weeks" and "1 month" as synonymous
-rw-r--r--filter/e-filter-datespec.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/filter/e-filter-datespec.c b/filter/e-filter-datespec.c
index d7aa93adc1..a7c2aa2f61 100644
--- a/filter/e-filter-datespec.c
+++ b/filter/e-filter-datespec.c
@@ -432,12 +432,30 @@ filter_datespec_format_sexp (EFilterElement *element,
g_string_append_printf (out, "%d", (gint) fds->value);
break;
case FDST_X_AGO:
- g_string_append_printf (
- out, "(- (get-current-date) %d)", (gint) fds->value);
+ switch (get_best_span (fds->value)) {
+ case 5: /* months */
+ g_string_append_printf (out, "(get-relative-months (- 0 %d))", (gint) (fds->value / timespans[5].seconds));
+ break;
+ case 6: /* years */
+ g_string_append_printf (out, "(get-relative-months (- 0 %d))", (gint) (12 * fds->value / timespans[6].seconds));
+ break;
+ default:
+ g_string_append_printf (out, "(- (get-current-date) %d)", (gint) fds->value);
+ break;
+ }
break;
case FDST_X_FUTURE:
- g_string_append_printf (
- out, "(+ (get-current-date) %d)", (gint) fds->value);
+ switch (get_best_span (fds->value)) {
+ case 5: /* months */
+ g_string_append_printf (out, "(get-relative-months %d)", (gint) (fds->value / timespans[5].seconds));
+ break;
+ case 6: /* years */
+ g_string_append_printf (out, "(get-relative-months %d)", (gint) (12 * fds->value / timespans[6].seconds));
+ break;
+ default:
+ g_string_append_printf (out, "(+ (get-current-date) %d)", (gint) fds->value);
+ break;
+ }
break;
}
}