Refactored date String <-> Calendar conversions.