About DateTime

Oct 8, 2015 at 10:22 AM
Hi Siyamand I hope wouldn't disturb you with posting too much issues ;)
There are logistic Errors about dateTime
1- One of Them is in grouping by DateTime in ActivityStream
Because we save DateTime as UTC and get them back with only Date Part, the dates may changed and not showing Exact Day of user zone
///////////////////////////////////////////
2- Another thing is using SetSiteTimeZone
as you know orchard Display helper is pretty cool on converting Date-Time to user zone and Local calendar
In ActivityStreamPartDriver--->Display method-->
 items.ForEach(c =>
            {
                session.Evict(c);
                c.CreationDateTime = this.SetSiteTimeZone(c.CreationDateTime);
            });
I think this method may cause problem if we use it too frequently .
The best way is using Display method in Razor specially when we need to show DateTimes to users
If we want to format the dateTime in Views and show them to user The Razor Helper convert The converted DateTime which is an Error

Regards
Oct 8, 2015 at 10:47 AM
For First Logic Error I Think changing the line to below solve the issue
  var groupsByDay = items.GroupBy(c => this.SetSiteTimeZone(c.CreationDateTime).Date).OrderByDescending(c => c.Key).ToList();
Coordinator
Oct 16, 2015 at 7:51 AM
Edited Oct 18, 2015 at 7:34 AM
Hi,

Thanks for the feedback. I appreciate it.

I totally agree with you. I will fix it in the source code too.

Regards,