date picker function works appropriately