Skip to content
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 working/business days to a date #39

Merged
merged 3 commits into from
Sep 26, 2016

Conversation

brucealdridge
Copy link
Contributor

@brucealdridge brucealdridge commented Sep 20, 2016

Add the ability to calculate business days.
Ie 'Expect your parcel to arrive in 7 business days'

$sevenBusinessDays = Yasumi::addWorkingDays('USA', 7, new \DateTime('2016-07-01', new \DateTimeZone('America/New_York')))
$sevenBusinessDays->format('Y-m-d');

@stelgenhof
Copy link
Member

@brucealdridge Thanks for this one! I like it :) If I understand correctly this feature returns the first coming business in the next ## days, right? In that case, I prefer the function name to represent what it returns rather than the action ('adding days').

For completeness sake, we should also then have the possibility to look at past business days. Can't think of a use case right now, however would be good to have too.

@brucealdridge
Copy link
Contributor Author

An example would be customer service.
Instead of

echo "We will get back to you within 2 business days";
echo "We will get back to you by ".
  Yasumi::addWorkingDays(
      'USA', 
      2, 
      new \DateTime('2016-07-01', new \DateTimeZone('America/New_York'))
   )->format('Y-m-d');

Fairly trivial to add removeBusinessDays, nextWorkingDay and previousWorkingDay but I see less of a use case for those

@stelgenhof
Copy link
Member

stelgenhof commented Sep 21, 2016

Yes, that makes sense. I was talking more semantically as for the function names. I think nextWorkingDay and previousWorkingDay make more sense. The functions then return either the next or previous working day based on the number of days given (as you coded). The default could be 1 day.

@brucealdridge
Copy link
Contributor Author

Sounds good, I'll adjust the naming

@stelgenhof stelgenhof added this to the v1.5.0 milestone Sep 26, 2016
@stelgenhof stelgenhof merged commit 4562c1b into azuyalabs:master Sep 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants