mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Updating a couple of DateTime helpers (Html.DateTime and the PublishedState shape template) to use ToLocalTime()
--HG-- branch : dev
This commit is contained in:
@@ -22,7 +22,7 @@ namespace Orchard.Core.Shapes {
|
|||||||
var time = _clock.UtcNow - dateTimeUtc;
|
var time = _clock.UtcNow - dateTimeUtc;
|
||||||
|
|
||||||
if (time.TotalDays > 7)
|
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)
|
if (time.TotalHours > 24)
|
||||||
return T.Plural("1 day ago", "{0} days ago", time.Days);
|
return T.Plural("1 day ago", "{0} days ago", time.Days);
|
||||||
if (time.TotalMinutes > 60)
|
if (time.TotalMinutes > 60)
|
||||||
|
@@ -226,7 +226,7 @@ namespace Orchard.Mvc.Html {
|
|||||||
|
|
||||||
public static LocalizedString DateTime(this HtmlHelper htmlHelper, DateTime value) {
|
public static LocalizedString DateTime(this HtmlHelper htmlHelper, DateTime value) {
|
||||||
//TODO: (erikpo) This default format should come from a site setting
|
//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) {
|
public static LocalizedString DateTime(this HtmlHelper htmlHelper, DateTime value, LocalizedString customFormat) {
|
||||||
|
Reference in New Issue
Block a user