Today's surprise was that "2009-01-01" and "2009-1-1" get parsed differently by the YAML parser in Rails. The former gets converted to a Date, while the latter becomes a String. It confused me for a while, as the problem only showed up when I wanted to send the dates to a Flot chart. Looking at the standard, it's conforming behaviour. Must be me that is non-conforming then...


Comments


Thanks for taking the time to contribute.

All comments are moderated and I reserve the right to remove comments for any reason, including abusiveness, illegality, and spam links.

Comments are plain text, with blank lines seperating paragraphs. Anything that looks like a URI will become a link. Any HTML will be escaped and appear as you type it in.

(optional, will not be published)
(used to link your comment back to you)

Parsing YAML Dates in Rails Gives Surprising Results
Written: 7-3-2009
Tags: