pulled most calendar related code into directive