Add DateOnly support
See original GitHub issueWould be nice to have this built in to the library, currently using this custom converter:
using System;
using KellermanSoftware.CompareNetObjects;
using KellermanSoftware.CompareNetObjects.TypeComparers;
namespace BestConnection.Application.Auditing
{
public class DateOnlyComparer : BaseTypeComparer
{
public DateOnlyComparer(RootComparer rootComparer) : base(rootComparer)
{
}
public override bool IsTypeMatch(Type type1, Type type2)
{
return type1 == typeof(DateOnly) || type2 == typeof(DateOnly);
}
public override void CompareType(CompareParms parms)
{
var date1 = (DateOnly?)parms.Object1;
var date2 = (DateOnly?)parms.Object2;
if (date1 != date2)
{
parms.Result.Differences.Add(new Difference()
{
PropertyName = parms.BreadCrumb,
Object1 = date1?.ToString("yyyy-MM-dd"),
Object2 = date2?.ToString("yyyy-MM-dd")
});
}
}
}
}
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
How to use the DateOnly and TimeOnly structures
Add or subtract days, months, years ... There are three methods used to adjust a DateOnly structure: AddDays, AddMonths, and AddYears. Each method ......
Read more >Learn DateOnly & TimeOnly
In this article learn how to work with DateOnly and TimeOnly with SqlClient data provider, Newtonsoft Json.net and Entity Framework Core 7. ✔️ ......
Read more >Support the new BCL DateOnly and TimeOnly structs for ...
What's the common workaround? builder.Properties<DateOnly>().HaveConversion(typeof(DateTime)); does not do the trick. If possible at all ...
Read more >How to Map DateOnly and TimeOnly Types to SQL
Describe how to map DateOnly and TimeOnly types to SQL with migration in .NET including rich code samples and detailed explanation.
Read more >DateOnly and TimeOnly support with Entity Framework Core 6.0
Sqlite fully supports both DateOnly and TimeOnly, so we can use them with Entity Framework Core 6.0 and the SQLite provider. But… What...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@Kebechet Sorry I started a new side project. I have very little time. If you would like to create a pull request for this I would be happy to approve.
Completed: https://github.com/GregFinzer/Compare-Net-Objects/pull/290