A logical approach to represent and reason about calendars