mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Added ToBestDateString for DateTime, using on Series/Details.
This commit is contained in:
parent
5f0a95b2b1
commit
9271b39787
@ -125,6 +125,7 @@
|
||||
<virtualDirectory path="/" physicalPath="%NZBDRONE_PATH%\NZBDrone.Web" />
|
||||
</application>
|
||||
<bindings>
|
||||
<binding protocol="http" bindingInformation="*:8989:localhost" />
|
||||
<binding protocol="http" bindingInformation="*:8989:" />
|
||||
</bindings>
|
||||
</site>
|
||||
|
@ -28,5 +28,22 @@ public static Int64 Gigabytes(this int gigabytes)
|
||||
{
|
||||
return gigabytes * 1073741824L;
|
||||
}
|
||||
|
||||
public static string ToBestDateString(this DateTime dateTime)
|
||||
{
|
||||
if (dateTime == DateTime.Today.AddDays(-1))
|
||||
return "Yesterday";
|
||||
|
||||
if (dateTime == DateTime.Today)
|
||||
return "Today";
|
||||
|
||||
if (dateTime == DateTime.Today.AddDays(1))
|
||||
return "Tomorrow";
|
||||
|
||||
if (dateTime > DateTime.Today.AddDays(1) && dateTime < DateTime.Today.AddDays(7))
|
||||
return dateTime.DayOfWeek.ToString();
|
||||
|
||||
return dateTime.ToShortDateString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using MvcMiniProfiler;
|
||||
using NzbDrone.Core;
|
||||
using NzbDrone.Core.Helpers;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Jobs;
|
||||
@ -199,7 +200,7 @@ private List<EpisodeModel> GetEpisodeModels(IList<Episode> episodesInDb)
|
||||
var airDate = String.Empty;
|
||||
|
||||
if (e.AirDate != null)
|
||||
airDate = e.AirDate.Value.ToShortDateString();
|
||||
airDate = e.AirDate.Value.ToBestDateString();
|
||||
|
||||
episodes.Add(new EpisodeModel
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user