refactoring date picker functions a bit