< Summary

Information
Class: Syki.Shared.DateOnlyExtensions
Assembly: Shared
File(s): /home/runner/work/syki/syki/Shared/Extensions/DateOnlyExtensions.cs
Tag: 22_11348620282
Line coverage
75%
Covered lines: 3
Uncovered lines: 1
Coverable lines: 4
Total lines: 27
Line coverage: 75%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
IsHoliday(...)100%11100%
ToDateOnly(...)100%11100%
ToDateOnly(...)100%11100%
FormatBr(...)100%210%

File(s)

/home/runner/work/syki/syki/Shared/Extensions/DateOnlyExtensions.cs

#LineLine coverage
 1using BrazilHolidays.Net;
 2using System.Globalization;
 3
 4namespace Syki.Shared;
 5
 6public static class DateOnlyExtensions
 7{
 8    public static bool IsHoliday(this DateOnly day)
 9    {
 910        return day.ToDateTime(TimeOnly.Parse("12:00")).IsHoliday();
 11    }
 12
 13    public static DateOnly ToDateOnly(this string date)
 14    {
 1815        return DateOnly.ParseExact(date, "dd/MM/yyyy", CultureInfo.InvariantCulture);
 16    }
 17
 18    public static DateOnly ToDateOnly(this DateTime dateTime)
 19    {
 17220        return DateOnly.FromDateTime(dateTime);
 21    }
 22
 23    public static string FormatBr(this DateOnly date)
 24    {
 025        return date.ToString("dd/MM/yyyy");
 26    }
 27}