Created On field affects VersionCreatedUtc

Topics: Announcements, General
Oct 3, 2014 at 12:47 PM
I 'm using Created On field of CommonPart to show blog posts in right orders. For example, I can set Created on date to past to describe last events.
In Orchard 1.8 I faced with behaviour, when Created On date resets on first Publish. It is confusing and looks like bug, so I have created the issue here:

But I think problem is deeper. Now I see following code:
var utcDateTime = _dateServices.ConvertFromLocalString(model.Editor.Date, model.Editor.Time);
part.CreatedUtc = utcDateTime;
part.VersionCreatedUtc = utcDateTime;
So user entered Created On time assign to VersionCreatedUtc and it is looks very strange for me. Is it really right according to Orchard CMS versioning functionality, does it break something?

I think, that is the reason why Created On field resets
var thisIsTheInitialVersionRecord = part.ContentItem.Version < 2;
var theDatesHaveNotBeenModified = part.CreatedUtc == part.VersionCreatedUtc;
var theContentDateShouldBeUpdated = thisIsTheInitialVersionRecord && theDatesHaveNotBeenModified;

if (theContentDateShouldBeUpdated) {
    // "touch" CreatedUtc in ContentItemRecord
    part.CreatedUtc = part.PublishedUtc;