Skip to content

Commit

Permalink
Drop NET6 and implement DebuggerDisplay attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
geoperez committed Jun 8, 2024
1 parent ddd2823 commit 1cb6880
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 30 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ jobs:
name: Build
runs-on: windows-latest
steps:
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.x
8.x
- name: ☕ Set up JDK 17
uses: actions/setup-java@v3
with:
Expand Down
5 changes: 4 additions & 1 deletion src/Unosquare.DateTimeExt/DateRange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace Unosquare.DateTimeExt;
/// <summary>
/// Represents a range of dates with a start and end date.
/// </summary>
[DebuggerDisplay("Date Range ({ToDateRangeString()})")]
public class DateRange : RangeBase<DateTime, DateTime>, IReadOnlyDateRange, IHasReadOnlyMidnightEndDate, IComparable<DateRange>, IEnumerable<DateTime>, IHasBusinessDays
{
/// <summary>
Expand Down Expand Up @@ -40,7 +41,9 @@ public DateRange(DateTime startDate, DateTime? endDate = null)

public DateRangeRecord ToRecord() => new() { StartDate = StartDate, EndDate = EndDate };

public override string ToString() => $"{StartDate.ToShortDateString()} - {EndDate.ToShortDateString()}";
public string ToDateRangeString() => $"{StartDate.ToShortDateString()} - {EndDate.ToShortDateString()}";

public override string ToString() => ToDateRangeString();

public override int GetHashCode() => StartDate.GetHashCode() + EndDate.GetHashCode();

Expand Down
1 change: 1 addition & 0 deletions src/Unosquare.DateTimeExt/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
global using System.Diagnostics;
global using System.Globalization;
2 changes: 2 additions & 0 deletions src/Unosquare.DateTimeExt/MonthToDate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Unosquare.DateTimeExt;

[DebuggerDisplay("MTD {Year}-{Month} ({ToDateRangeString()})")]
public class MonthToDate : YearMonth
{
public MonthToDate(int? month = null, int? year = null)
Expand All @@ -23,6 +24,7 @@ public MonthToDate(IHasReadOnlyMonth readOnlyMonth, IHasReadOnlyYear readOnlyYea
: this(readOnlyMonth.Month, readOnlyYear.Year)
{
}

public new DateTime EndDate => base.EndDate.OrToday();

public override string ToString() => $"MTD: {base.ToString()}";
Expand Down
4 changes: 2 additions & 2 deletions src/Unosquare.DateTimeExt/Unosquare.DateTimeExt.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>preview</LangVersion>
<AnalysisLevel>latest</AnalysisLevel>
<CodeAnalysisRuleSet>..\..\StyleCop.Analyzers.ruleset</CodeAnalysisRuleSet>
<Version>1.3.5</Version>
<Version>1.4.0</Version>
</PropertyGroup>

</Project>
1 change: 1 addition & 0 deletions src/Unosquare.DateTimeExt/YearMonth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Unosquare.DateTimeExt;

[DebuggerDisplay("{ToString()} ({ToDateRangeString()})")]
public class YearMonth : YearAbstract, IYearMonthDateRange, IComparable<YearMonth>
{
public YearMonth(int? month = null, int? year = null)
Expand Down
1 change: 1 addition & 0 deletions src/Unosquare.DateTimeExt/YearQuarter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Unosquare.DateTimeExt;

[DebuggerDisplay("{ToString()} ({ToDateRangeString()})")]
public class YearQuarter : DateRange, IYearQuarterDateRange, IComparable<YearQuarter>, IHasMonths
{
private const int QuarterMonths = 3;
Expand Down
1 change: 1 addition & 0 deletions src/Unosquare.DateTimeExt/YearToDate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Unosquare.DateTimeExt;

[DebuggerDisplay("YTD {Year} ({ToDateRangeString()})")]
public sealed class YearToDate : YearAbstract, IHasReadOnlyMonth, IHasYearMonths, IHasYearQuarters
{
public YearToDate(IHasReadOnlyYear readOnlyYear)
Expand Down
1 change: 1 addition & 0 deletions src/Unosquare.DateTimeExt/YearWeek.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Unosquare.DateTimeExt;

[DebuggerDisplay("Week {Year}-W{Week} ({ToDateRangeString()})")]
public sealed class YearWeek : YearWeekBase, IComparable<YearWeek>
{
public YearWeek(int? week = null, int? year = null)
Expand Down
1 change: 1 addition & 0 deletions src/Unosquare.DateTimeExt/YearWeekIso.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Unosquare.DateTimeExt;

[DebuggerDisplay("ISO Week {Year}-W{Week} ({ToDateRangeString()})")]
public sealed class YearWeekIso : YearWeekBase, IComparable<YearWeekIso>
{
public YearWeekIso(int week, int year)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\Unosquare.DateTimeExt\Unosquare.DateTimeExt.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\src\Unosquare.DateTimeExt\Unosquare.DateTimeExt.csproj" />
</ItemGroup>
</Project>

0 comments on commit 1cb6880

Please sign in to comment.