[banshee] Fix off-by-one-day date querying bug (BGO #546844)
- From: Gabriel Burt <gburt src gnome org>
- To: svn-commits-list gnome org
- Subject: [banshee] Fix off-by-one-day date querying bug (BGO #546844)
- Date: Thu, 11 Jun 2009 14:30:55 -0400 (EDT)
commit 74116c772dab934088f2481b41a7c32a69f70298
Author: Jensen Somers <jensen somers gmail com>
Date: Thu Jun 11 13:28:03 2009 -0500
Fix off-by-one-day date querying bug (BGO #546844)
Signed-off-by: Gabriel Burt <gabriel burt gmail com>
src/Libraries/Hyena/Hyena.Query/DateQueryValue.cs | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/Libraries/Hyena/Hyena.Query/DateQueryValue.cs b/src/Libraries/Hyena/Hyena.Query/DateQueryValue.cs
index 36e17a5..4a5e062 100644
--- a/src/Libraries/Hyena/Hyena.Query/DateQueryValue.cs
+++ b/src/Libraries/Hyena/Hyena.Query/DateQueryValue.cs
@@ -45,7 +45,7 @@ namespace Hyena.Query
//public static readonly Operator LessThanEqual = new Operator ("lessThanEquals", "<= {0}", "<=");
//public static readonly Operator GreaterThanEqual = new Operator ("greaterThanEquals", ">= {0}", ">=");
public static readonly Operator LessThan = new Operator ("lessThan", Catalog.GetString ("before"), "< {0}", true, "<");
- public static readonly Operator GreaterThan = new Operator ("greaterThan", Catalog.GetString ("after"), "> {0}", ">");
+ public static readonly Operator GreaterThan = new Operator ("greaterThan", Catalog.GetString ("after"), ">= {0}", ">");
protected DateTime value = DateTime.Now;
@@ -108,7 +108,11 @@ namespace Hyena.Query
public override string ToSql (Operator op)
{
- return DateTimeUtil.FromDateTime (value).ToString (System.Globalization.CultureInfo.InvariantCulture);
+ if (op == GreaterThan) {
+ return DateTimeUtil.FromDateTime (value.AddDays (1.0)).ToString (System.Globalization.CultureInfo.InvariantCulture);
+ } else {
+ return DateTimeUtil.FromDateTime (value).ToString (System.Globalization.CultureInfo.InvariantCulture);
+ }
}
public DateTime DateTime {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]