I need to define custom calendars and, in particular, test a DateTime for being a holiday. My current code is shown below. Is there a more concise/better way of doing this, preferably without sacrificing performance?
let private isHoliday2011 (dt:DateTime) =
match dt.DayOfWeek with
| DayOfWeek.Saturday | DayOfWeek.Sunday ->
match (dt.Month, dt.Day) with
| (3,5) -> false
| _ -> true
| _ ->
match dt.Month with
| 1 ->
match dt.Day with
| 3 | 4 | 5 | 6 | 7 | 10 -> true
| _ -> false
| 2 ->
match dt.Day with
| 23 -> true
| _ -> false
| 3 ->
match dt.Day with
| 7 | 8 -> true
| _ -> false
| 5 ->
match dt.Day with
| 2 | 9 -> true
| _ -> false
| 6 ->
match dt.Day with
| 13 -> true
| _ -> false
| 11 ->
match dt.Day with
| 4 -> true
| _ -> false
| _ -> false