Extract datetime logic for reuse

www.agileplannerapp.com/boards/173808/cards/8805