Skip to content

Commit

Permalink
fix broken TZ change
Browse files Browse the repository at this point in the history
  • Loading branch information
ninianne98 committed Nov 11, 2021
1 parent f556739 commit 6c32e6e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions CMSCore/Utilities/SiteTimeZone.cs
Expand Up @@ -19,7 +19,6 @@
namespace Carrotware.CMS.Core {

public class ContentLocalTime {

public DateTime GoLiveDate { get; set; }

public DateTime GoLiveDateLocal { get; set; }
Expand Down Expand Up @@ -71,7 +70,6 @@ public class TimeZoneContent {
where p.ContentTypeID == ContentPageType.GetIDByType(ContentPageType.PageType.BlogEntry)
select p.GoLiveDate).Distinct().ToList();


this.ContentLocalDates = (from d in allContentDates
select new ContentLocalTime() {
GoLiveDate = d,
Expand All @@ -82,10 +80,20 @@ public class TimeZoneContent {
join ld in this.ContentLocalDates on bd equals ld.GoLiveDate
select new BlogPostPageUrl() {
GoLiveDate = ld.GoLiveDate,
PostPrefix = ContentPageHelper.CreateFileNameFromSlug(siteID, ld.GoLiveDateLocal, string.Empty),
PostPrefix = CleanPostPrefix(ContentPageHelper.CreateFileNameFromSlug(siteID, ld.GoLiveDateLocal, string.Empty)),
GoLiveDateLocal = ld.GoLiveDateLocal
}).ToList();
}

private string CleanPostPrefix(string pathIn) {
string pathOut = pathIn;

if (!string.IsNullOrEmpty(pathIn) &&
pathIn.ToLowerInvariant().EndsWith(SiteData.DefaultDirectoryFilename.ToLowerInvariant())) {
pathOut = pathIn.Substring(0, pathIn.Length - SiteData.DefaultDirectoryFilename.Length);
}

return pathOut;
}

public void Save() {
Expand Down

0 comments on commit 6c32e6e

Please sign in to comment.