calendar selection refactoring