Skip to content

Commit c4101d3

Browse files
authored
Merge pull request mcintyre321#174 from curtisy1/master
Convert range filter dates to universaltime
2 parents 334edea + f3f94c4 commit c4101d3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Mvc.JQuery.DataTables.Common/Processing/TypeFilters.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,14 @@ public static string DateTimeOffsetFilter(string query, string columnname, DataT
111111
DateTimeOffset start, end;
112112
if (DateTimeOffset.TryParse(parts[0] ?? "", out start))
113113
{
114+
start = start.ToUniversalTime();
114115
filterString = columnname + " >= @" + parametersForLinqQuery.Count;
115116
parametersForLinqQuery.Add(start);
116117
}
117118

118119
if (DateTimeOffset.TryParse(parts[1] ?? "", out end))
119120
{
121+
end = end.ToUniversalTime();
120122
filterString = (filterString == null ? null : filterString + " and ") + columnname + " <= @" + parametersForLinqQuery.Count;
121123
parametersForLinqQuery.Add(end);
122124
}
@@ -161,12 +163,14 @@ public static string DateTimeFilter(string query, string columnname, DataTablesP
161163
DateTime start, end;
162164
if (DateTime.TryParse(parts[0] ?? "", out start))
163165
{
166+
start = start.ToUniversalTime();
164167
filterString = columnname + " >= @" + parametersForLinqQuery.Count;
165168
parametersForLinqQuery.Add(start);
166169
}
167170

168171
if (DateTime.TryParse(parts[1] ?? "", out end))
169172
{
173+
end = end.ToUniversalTime();
170174
filterString = (filterString == null ? null : filterString + " and ") + columnname + " <= @" + parametersForLinqQuery.Count;
171175
parametersForLinqQuery.Add(end);
172176
}
@@ -254,4 +258,4 @@ public static string EnumFilter(string q, string columnname, DataTablesPropertyI
254258
return columnname + " == @" + (parametersForLinqQuery.Count - 1);
255259
}
256260
}
257-
}
261+
}

0 commit comments

Comments
 (0)