Fix equal dates issue
This commit is contained in:
parent
d48c1ccf8e
commit
cecdcb20e1
|
@ -26,9 +26,9 @@ func (v Vehicle) Free(start time.Time, end time.Time) bool {
|
||||||
for _, b := range v.Bookings {
|
for _, b := range v.Bookings {
|
||||||
fmt.Println("Bookings for", v)
|
fmt.Println("Bookings for", v)
|
||||||
fmt.Println(b)
|
fmt.Println(b)
|
||||||
if (start.Before(b.Unavailablefrom) && end.After(b.Unavailablefrom.Add(24*time.Hour))) ||
|
if ((start.Before(b.Unavailablefrom) || start.Equal(b.Unavailablefrom)) && (end.After(b.Unavailablefrom.Add(24*time.Hour)) || end.Equal(b.Unavailablefrom.Add(24*time.Hour)))) ||
|
||||||
(start.Before(b.Unavailableto) && end.After(b.Unavailableto.Add(24*time.Hour))) ||
|
((start.Before(b.Unavailableto) || start.Equal(b.Unavailableto)) && (end.After(b.Unavailableto.Add(24*time.Hour)) || end.Equal(b.Unavailableto.Add(24*time.Hour)))) ||
|
||||||
(start.After(b.Unavailablefrom) && end.Before(b.Unavailableto.Add(24*time.Hour))) {
|
((start.After(b.Unavailablefrom) || start.Equal(b.Unavailablefrom)) && (end.Before(b.Unavailableto.Add(24*time.Hour)) || end.Equal(b.Unavailableto.Add(24*time.Hour)))) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue