Skip to content

Commit 9fc6c01

Browse files
committed
Added a sort parameter to the search by date method.
1 parent 5effd68 commit 9fc6c01

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

RedditSharp/Things/Subreddit.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,11 @@ public Listing<Post> Search(string terms)
179179
return new Listing<Post>(Reddit, string.Format(SearchUrl, Name, Uri.EscapeUriString(terms), "relevance", "all"), WebAgent);
180180
}
181181

182-
public Listing<Post> Search(DateTime from, DateTime to)
182+
public Listing<Post> Search(DateTime from, DateTime to, Sorting sortE = Sorting.New)
183183
{
184-
return new Listing<Post>(Reddit, string.Format(SearchUrlDate, Name, from.DateTimeToUnixTimestamp(), to.DateTimeToUnixTimestamp(), "new"), WebAgent);
184+
string sort = sortE.ToString().ToLower();
185+
186+
return new Listing<Post>(Reddit, string.Format(SearchUrlDate, Name, from.DateTimeToUnixTimestamp(), to.DateTimeToUnixTimestamp(), sort), WebAgent);
185187
}
186188

187189
public SubredditSettings Settings

0 commit comments

Comments
 (0)