Support for DateOnly
Closed this issue · 1 comments
wdnijdam commented
Since net7 we prefer to use DateOnly instead of DateTime for date calculations
Please add a compiler switch using DateOnly starting from net7
The DateOnly type more clearly expresses the intention and furthermore date calculations like .AddDays() are more efficient.
martinjw commented
Agreed DateOnly is preferable, but it is a breaking change, and it will break when people upgrade their main project with this dependency- DateOnly != DateTime
It is possible to add overloads to some methods to take a DateOnly, but all the underlying logic still uses DateTime:
public bool IsPublicHoliday(DateOnly do) => IsPublicHoliday(dt.ToDateTime(new TimeOnly(0, 0)));
At some point I will do a major version change, and I will look at this again then.