mills
-
Posts
7 -
Joined
-
Last visited
Reputation Activity
-
mills reacted to deanishe in Modified date calc based on input
Be sure to test it well to make sure it's really giving you the right dates.
-
mills reacted to deanishe in Modified date calc based on input
Try this new version.
I changed main so it always counts from the right start date:
start = date.today() + timedelta(days=n) data = { 'ordered': start.strftime(DATE_FMT), 'd10': add_days(10, start), 'd12': add_days(12, start), } Now it gives you the same delivery date for an order placed on Friday, Saturday or Sunday.
-
mills reacted to deanishe in Modified date calc based on input
If orders can be placed on any day of the week, and weekdays/weekends are only a factor in the delivery time, then yeah. Change the line that says
'ordered': add_days(n),
to
'ordered': (date.today() + timedelta(days=n)).strftime(DATE_FMT),
-
mills reacted to deanishe in Modified date calc based on input
Here's a version of your workflow that ignores weekends.
It doesn't know anything about public holidays, though.