Fix travis failing tests

@samsonasik Single PR for #6603 and #6605
what about building a `DateTime` instance and serializing it instead? Seems saner than conditionally switching the entire block based on multiple conditionals