Skip to content
This repository has been archived by the owner on Jul 28, 2020. It is now read-only.

Fixes weekday and DayOfMonth methods to wait until the specified next day #7

Closed
wants to merge 2 commits into from

Conversation

mKurrels
Copy link
Contributor

per the discussion with @geomagilles:

if we are Monday, 11am on the 23rd of the month. Then:

.Monday(1) should wait until next Monday at 11am
.Monday(1).At("9") should wait until next Monday at 9am
.Monday(1).At("13") should wait 2 hours only
.DayOfMonth(23) should wait for one month
.DayOfMonth(23).At("13") should wait for only 2 hours.

@@ -380,33 +380,42 @@ func (w *WaitTask) _dayOfMonth(day int, now, then time.Time) (time.Time, error)
return time.Time{}, err
}

then = time.Date(now.Year(), now.Month(), day, now.Hour(), now.Minute(), now.Second(), now.Nanosecond(), w.timezone)
then = time.Date(then.Year(), then.Month(), day, then.Hour(), then.Minute(), then.Second(), then.Nanosecond(), w.timezone)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a fix for an unrelated problem than the main one of this pull request.

@Ciboulette Ciboulette closed this Jul 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants