Updating a couple of DateTime helpers (Html.DateTime and the PublishedState shape template) to use ToLocalTime()

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-11-22 14:43:43 -08:00
parent 916521c8ad
commit 579d16bd23
2 changed files with 2 additions and 2 deletions

View File

@@ -22,7 +22,7 @@ namespace Orchard.Core.Shapes {
var time = _clock.UtcNow - dateTimeUtc;
if (time.TotalDays > 7)
return Html.DateTime(dateTimeUtc, T("'on' MMM d yyyy 'at' h:mm tt"));
return Html.DateTime(dateTimeUtc.ToLocalTime(), T("'on' MMM d yyyy 'at' h:mm tt"));
if (time.TotalHours > 24)
return T.Plural("1 day ago", "{0} days ago", time.Days);
if (time.TotalMinutes > 60)

View File

@@ -226,7 +226,7 @@ namespace Orchard.Mvc.Html {
public static LocalizedString DateTime(this HtmlHelper htmlHelper, DateTime value) {
//TODO: (erikpo) This default format should come from a site setting
return htmlHelper.DateTime(value, new LocalizedString("MMM d yyyy h:mm tt")); //todo: above comment and get rid of just wrapping this as a localized string
return htmlHelper.DateTime(value.ToLocalTime(), new LocalizedString("MMM d yyyy h:mm tt")); //todo: above comment and get rid of just wrapping this as a localized string
}
public static LocalizedString DateTime(this HtmlHelper htmlHelper, DateTime value, LocalizedString customFormat) {