aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-06-20 19:57:48 +0800
committerMilan Crha <mcrha@redhat.com>2011-06-20 19:57:48 +0800
commitd3f72293ce36ffded8e9807a2a42e13ae6ca8a32 (patch)
tree4f2b2e087c127d22b294a3d317d1cc7e59ba0537
parent1524e8f23466d54951c1279534a538bbd341d65e (diff)
downloadgsoc2013-evolution-d3f72293ce36ffded8e9807a2a42e13ae6ca8a32.tar.gz
gsoc2013-evolution-d3f72293ce36ffded8e9807a2a42e13ae6ca8a32.tar.zst
gsoc2013-evolution-d3f72293ce36ffded8e9807a2a42e13ae6ca8a32.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;
}
}