MattCocci / FredFetch

For pulling current and vintage date from FRED and ALFRED API
5 stars 9 forks source link

Fixed bug in dtnum that breaks for ver<2014a #2

Closed micahjsmith closed 9 years ago

micahjsmith commented 9 years ago

fred.dtnum takes as input a string or cell array of strings and returns Matlab datenums. Given these inputs, there is no requirement that the input strings conform to the format 'yyyy-mm-dd'. This was breaking for versions <2014a. For 2014a, the call to fred.dtnum(date()) was parsing a date that is by default in format dd-mmm-yyyy as the above format, returning a date in 2035.

MattCocci commented 9 years ago

I specified yyyy-mm-dd because specifying the format string appears to speed up datenum() considerably.

I'll merge this change, then add an optional argument for fred.dtnum to signify whether the format is yyyy-mm-dd or not, so we can still get a speedup in behind-the-scenes calls to fred.dtnum.