question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add DateOnly support

See original GitHub issue

Would 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:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
GregFinzercommented, Jan 6, 2023

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found