I have orders that come in it at various times during the week and I have a set of rules for when we can and cannot accept orders. For example, we don't accept orders between 4:45pm and 5:15pm on Wednesday. So if an order came in at 3pm, everything is fine. If an order came in at 5pm we would need to reject it. These rules are based on the day of the week and change daily.
My question, is using joda time, what is the best way to check if the current time is in this time window?
I'm open to other technologies, however I'm currently using joda time through the scala tools time wrapper.
I'm currently working with something like this:
val now = DateTime.now
val wednesdayNoTradeInterval:Interval = ??
now.getDayOfWeek match {
case WEDNESDAY => wednesdayNoTradeInterval.contains(now)
}