diff options
author | Milan Crha <mcrha@redhat.com> | 2011-06-20 19:57:48 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:42:30 +0800 |
commit | 876befb7b17f99d6baf2d6dfb42e8f3f64af93ff (patch) | |
tree | 676b139fd5529328f28b2e59cc5d8a3b3019f30a | |
parent | 79c3d4971021ed969550af58e3cdb1f6b6e29713 (diff) | |
download | gsoc2013-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.c | 26 |
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; } } |