Prevent clamping dates that start after the end of the month
Signed-off-by: Ben Ridley <benridley29@gmail.com>
This commit is contained in:
parent
adf94c3168
commit
2c86b696c9
|
@ -363,6 +363,10 @@ func (tp TimeInterval) ContainsTime(t time.Time) bool {
|
||||||
} else {
|
} else {
|
||||||
end = validDates.End
|
end = validDates.End
|
||||||
}
|
}
|
||||||
|
// Skip clamping if the beginning date is after the end of the month
|
||||||
|
if begin > daysInMonth {
|
||||||
|
continue
|
||||||
|
}
|
||||||
// Clamp to the boundaries of the month to prevent crossing into other months
|
// Clamp to the boundaries of the month to prevent crossing into other months
|
||||||
begin = clamp(begin, -1*daysInMonth, daysInMonth)
|
begin = clamp(begin, -1*daysInMonth, daysInMonth)
|
||||||
end = clamp(end, -1*daysInMonth, daysInMonth)
|
end = clamp(end, -1*daysInMonth, daysInMonth)
|
||||||
|
|
Loading…
Reference in New Issue