-
-
Notifications
You must be signed in to change notification settings - Fork 383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Business Hours Check Extension Method #184
Comments
Hi, Method Signature:bool IsWithinBusinessHours(this DateTime dateTime, TimeSpan startTime, TimeSpan endTime) Purpose:This method helps determine if a given time is during standard working hours, useful for scheduling or customer support systems. Example Usage:DateTime now = DateTime.Now;
bool isWithinBusinessHours = now.IsWithinBusinessHours(new TimeSpan(9, 0, 0), new TimeSpan(17, 0, 0));
if (isWithinBusinessHours)
{
Console.WriteLine("The current time is within business hours.");
}
else
{
Console.WriteLine("The current time is outside business hours.");
} Hope help. ^-^ |
Hey! Thanks for the summary and If there's anything more to clarify, I'm happy to help. Otherwise, I'd be more than willing to contribute by implementing this feature and submitting a pull request if you’d like. Looking forward to your thoughts! |
How would you handle if the business is closed on Saturdays and Sundays? |
Is this issue resolved. Anyone? |
I still don't even know what the problem is. Maybe with a Unit test showing the expected result could help clear things up |
I am sure this can be closed... there is test coverage for the extension in BusinessHoursTests.cs |
Ok I am taking a look into it and will close it |
Description:
We could implement a new extension method
IsWithinBusinessHours
for theDateTime
class. This will help check if a specificDateTime
falls within a given range of business hours. The method should takestartTime
andendTime
asTimeSpan
parameters and returntrue
if theDateTime
is between them.Example Method Signature:
This feature would be handy for checking if a time is during standard working hours. It could be used in scheduling systems or for customer support hours.
Example Usage:
The text was updated successfully, but these errors were encountered: