mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
Added ToBestDateString for DateTime, using on Series/Details.
This commit is contained in:
parent
5f0a95b2b1
commit
9271b39787
3 changed files with 20 additions and 1 deletions
|
@ -28,5 +28,22 @@ namespace NzbDrone.Core
|
|||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue