diff --git a/src/managed/OpenLiveWriter.BlogClient/Clients/StaticSite/StaticSiteClient.cs b/src/managed/OpenLiveWriter.BlogClient/Clients/StaticSite/StaticSiteClient.cs
index d6f1e73c..ece8b37c 100644
--- a/src/managed/OpenLiveWriter.BlogClient/Clients/StaticSite/StaticSiteClient.cs
+++ b/src/managed/OpenLiveWriter.BlogClient/Clients/StaticSite/StaticSiteClient.cs
@@ -80,13 +80,12 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
remotePost = null;
etag = "";
- // Set Date if not provided
- if (post.DatePublished == new DateTime(1, 1, 1)) post.DatePublished = DateTime.Now;
-
// Create a StaticSitePost on the provided post
var ssgPost = new StaticSitePost(Config, post);
// Ensure the post has an ID
var newPostId = ssgPost.EnsureId();
+ // Ensure the post has a date
+ ssgPost.EnsureDatePublished();
// Save the post to disk
ssgPost.SaveToDisk();
diff --git a/src/managed/OpenLiveWriter.BlogClient/Clients/StaticSite/StaticSitePost.cs b/src/managed/OpenLiveWriter.BlogClient/Clients/StaticSite/StaticSitePost.cs
index 0ae0a087..c77c392b 100644
--- a/src/managed/OpenLiveWriter.BlogClient/Clients/StaticSite/StaticSitePost.cs
+++ b/src/managed/OpenLiveWriter.BlogClient/Clients/StaticSite/StaticSitePost.cs
@@ -61,6 +61,12 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
set => BlogPost.Slug = _safeSlug = value;
}
+ public DateTime DatePublished
+ {
+ get => BlogPost.DatePublished;
+ set => BlogPost.DatePublished = value;
+ }
+
///
/// Confirmed safe slug; does not conflict with any existing post on disk or points to this post on disk.
///
@@ -121,6 +127,16 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
return Id;
}
+ ///
+ /// Set post published DateTime to current DateTime if one isn't already set, or current one is default.
+ ///
+ /// The current or new DatePublished.
+ public DateTime EnsureDatePublished()
+ {
+ if (DatePublished == null || DatePublished == new DateTime(1, 1, 1)) DatePublished = DateTime.Now;
+ return DatePublished;
+ }
+
///
/// Generate a slug for this post based on it's title or a preferred slug
///