https://learn.microsoft.com/en-us/dotnet/api/system.timeonly.isbetween?view=net-9.0
TimeOnly.IsBetween(TimeOnly, TimeOnly) Method (System) | Microsoft Learn
Determines if a time falls within the range provided. Supports both "normal" ranges such as 10:00-12:00, and ranges that span midnight such as 23:00-01:00.
methodsystemmicrosoftlearn