< Summary

Information
Class: OzonDomains.OrderDateDisplay
Assembly: OzonDomains
File(s): /home/runner/work/Studio2Prod/Studio2Prod/OzonDomains/OrderDateDisplay.cs
Line coverage
100%
Covered lines: 14
Uncovered lines: 0
Coverable lines: 14
Total lines: 38
Line coverage: 100%
Branch coverage
100%
Covered branches: 10
Total branches: 10
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
FormatTableDate(...)100%88100%
FormatTableDateFull(...)100%22100%

File(s)

/home/runner/work/Studio2Prod/Studio2Prod/OzonDomains/OrderDateDisplay.cs

#LineLine coverage
 1namespace OzonDomains;
 2
 3/// <summary>
 4/// Компактный вывод дат в таблицах заказов (как в 1С):
 5/// сегодня — только время, текущий год — день + сокр. месяц, иначе — день + сокр. месяц + год.
 6/// </summary>
 7public static class OrderDateDisplay
 8{
 9    public static string FormatTableDate(DateTime? value, DateTime? referenceNow = null)
 10    {
 10211        if (!value.HasValue)
 6412            return string.Empty;
 13
 3814        var dt = value.Value;
 3815        var now = referenceNow ?? DateTime.Now;
 3816        var today = now.Date;
 3817        var date = dt.Date;
 18
 3819        if (date == today)
 120            return DateTimeAbbreviationService.FormatTime(dt);
 21
 3722        if (date.Year == today.Year)
 3623            return DateTimeAbbreviationService.FormatDayMonth(dt);
 24
 125        return DateTimeAbbreviationService.FormatDayMonthYear(dt);
 26    }
 27
 28    /// <summary>
 29    /// Полная дата для таблицы заказов: «19.06.2026».
 30    /// </summary>
 31    public static string FormatTableDateFull(DateTime? value)
 32    {
 3333        if (!value.HasValue)
 2334            return string.Empty;
 35
 1036        return DateTimeAbbreviationService.FormatFullDate(value.Value);
 37    }
 38}