Calculate the end date of given month. It contains a potential algorithm (leap year calculation).