Skip to content

Commit 782389e

Browse files
#8863: Fixing ArgumentException in Blog Archives widget (#8867)
1 parent 4cfbafd commit 782389e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Orchard.Web/Modules/Orchard.Blogs/Services/BlogPostService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,17 @@ private IContentQuery<ContentItem, CommonPartRecord> GetBlogArchiveQuery(BlogPar
7676
var query = GetBlogQuery(blogPart, VersionOptions.Published);
7777

7878
if (archiveData.Day > 0) {
79-
var dayDate = new DateTime(archiveData.Year, archiveData.Month, archiveData.Day);
79+
var dayDate = new DateTime(archiveData.Year, archiveData.Month, archiveData.Day, 0, 0, 0, DateTimeKind.Utc);
8080

8181
query = query.Where(cr => cr.CreatedUtc >= dayDate && cr.CreatedUtc < dayDate.AddDays(1));
8282
}
8383
else if (archiveData.Month > 0) {
84-
var monthDate = new DateTime(archiveData.Year, archiveData.Month, 1);
84+
var monthDate = new DateTime(archiveData.Year, archiveData.Month, 1, 0, 0, 0, DateTimeKind.Utc);
8585

8686
query = query.Where(cr => cr.CreatedUtc >= monthDate && cr.CreatedUtc < monthDate.AddMonths(1));
8787
}
8888
else {
89-
var yearDate = new DateTime(archiveData.Year, 1, 1);
89+
var yearDate = new DateTime(archiveData.Year, 1, 1, 0, 0, 0, DateTimeKind.Utc);
9090

9191
query = query.Where(cr => cr.CreatedUtc >= yearDate && cr.CreatedUtc < yearDate.AddYears(1));
9292
}

0 commit comments

Comments
 (0)