re: to_yaml fails for DateTime objects

I found this bug on Lighthouse with no patch and wrote a fix with
necessary tests. The patch is available on the ticket page (

This patch applies to 2-3-stable branch. I'll soon upload a patch for
master as well.

In the same ticket, I also attached a patch file for the master