How can I create a generic date (i.e. not attached to any actual yyMMdd
but similar to:
val START = LocalTime.of(startHour, startMinute)
val END = LocalTime.of(endHour, endMinute)
However, I additionally want to include the dayOfWeek
.
My intention is to calculate the overlap of time intervals, i.e. for two given (start, end) timestamps I want to calculate overlap with a specified weekday and time (i.e. like opening hours).
edit
I am not sure if a custom class is good enough. My intention is if I have a list of events like:
id,start,end
1,2018-01-01 08:00, 2018-01-01 08:00 || opening hours 8-10, duration: 1
2,2018-01-01 10:00, 2018-01-01 12:00 || opening hours 8-10, duration: 0
3,2018-01-02 10:00, 2018-01-02 12:00 || opening hours 10-15, duration 2
to validate if time interval of start-end
intersects with another time interval (i.e. opening hours), but this other time interval depends on the day of week.
After constructing the object (where I currently have my probably as I can't combine dayOfWeek and Time in a generic way)
I would use isBefore/isAfter
a couple of times and then calculate the duration of overlap.