You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've come across a situation where I'd like to have a date for "The friday that follows X". So if "X" is a tuesday, I want it to be the following friday, if X is a friday, it can return X. Similar to how first_business_day will return the given day if it is a business day, otherwise the next one. If the immediately following friday isn't a workday it can return the one after that. If you've done something impossible like chosen :saturday, and no Saturdays can be work days... maybe raise an error, or return nil.
I would propose perhaps just an additional param in first_business_day, something like:
I've come across a situation where I'd like to have a date for "The friday that follows X". So if "X" is a tuesday, I want it to be the following friday, if X is a friday, it can return X. Similar to how
first_business_day
will return the given day if it is a business day, otherwise the next one. If the immediately following friday isn't a workday it can return the one after that. If you've done something impossible like chosen:saturday
, and no Saturdays can be work days... maybe raise an error, or return nil.I would propose perhaps just an additional param in
first_business_day
, something like:Or:
Update:
FWIW I'm just going to do it this way for now, which is "good enough" for my use-case I think:
The text was updated successfully, but these errors were encountered: