Sort items in list by date

Jul 6, 2015 at 3:35 PM
I have a list template here:
@using ToSic.Eav.DataSources
@{ 
    int rowCounter = 0;
    var mid = Dnn.Module.ModuleID.ToString();
    var allItems = CreateSource<EntityTypeFilter>();
    allItems.TypeName = "Publications";
}

@foreach(var dict in allItems.List) {
var Content = AsDynamic(dict.Value);

[List item stuff here]

}
The above is unsorted. I want to sort the list by a datetime field I have called DateCreated.

I have tried this:
@using ToSic.Eav.DataSources
@{ 
    int rowCounter = 0;
    var mid = Dnn.Module.ModuleID.ToString();
    var allItems = CreateSource<EntityTypeFilter>();
    allItems.TypeName = "Publications";
  var sorted = CreateSource<ValueSort>(allItems);
        sorted.Attributes = "DateCreated";  
        Data.In.Add("Publication", sorted["Default"]);
}

@foreach (var dict in sorted.List) {
var Content = AsDynamic(dict.Value);

[List item stuff here]

}
But the items are not sorting properly. I had success with this method in another template when sorting by an integer field. Does it not work with datetime? Or is something else wrong?
Thanks