Make date object serialization code a bit more readable