Refinement of date adjustment function