micahjsmith / FredData.jl

Pull data from Federal Reserve Economic Data (FRED) directly into Julia
https://micahjsmith.github.io/FredData.jl/dev
Other
64 stars 19 forks source link

Formatting problem with TimeZones #16

Closed Herold1989 closed 4 years ago

Herold1989 commented 4 years ago

After upgrading to Julia 1.3.1 yesterday, I encountered the following error while trying to fetch the US GDP series from FRED:

MethodError: Cannot convert an object of type TimeZones.ZonedDateTime to an object of type DateTime
Closest candidates are:
 convert(::Type{DateTime}, !Matched::Date) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Dates/src/conversions.jl:30
 convert(::Type{DateTime}, !Matched::Millisecond) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Dates/src/conversions.jl:34
 convert(::Type{DateTime}, !Matched::PyCall.PyObject) at /Users/jensherold/.julia/packages/PyCall/ttONZ/src/pydates.jl:135
 ...
DateTime(::TimeZones.ZonedDateTime) at conversions.jl:20
(::FredData.var"#parse_last_updated#4")(::String) at get_data.jl:82
#get_data#3(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(get_data), ::Fred, ::String) at get_data.jl:84
get_data(::Fred, ::String) at get_data.jl:34
top-level scope at hp_filter_us_gdp_FRED_pull.jl:7

This is my minimum working example:

using FredData

f = Fred()
Fred_Key  = "GDPC1"
pull_data = get_data(f, Fred_Key)

I am running this code on Juno in Atom using FredData version v0.3.1

Any help/ideas is appreciated.

Best,

Jens

fratrik commented 4 years ago

I think if you type

> dev https://github.com/fratrik/FredData.jl.git

It will work until the pull request gets merged.

micahjsmith commented 4 years ago

Thanks for the report!

Looks like this was caused by the API change in https://github.com/JuliaTime/TimeZones.jl/commit/6401f808c1d79618904d2608ddfa65f3ec7459db#diff-9bc274dbfe972452e9acafe692c9fd38 which removed the DateTime(::ZonedDateTime) -> DateTime conversion method

micahjsmith commented 4 years ago

Closed by #17

micahjsmith commented 4 years ago

@Herold1989 @fratrik Version v0.4.0 with this bugfix has been released on the registry, please try to upgrade and confirm everything works for you!

Herold1989 commented 4 years ago

I checked both before and after updating to the new release. Worked flawless! Thanks for solving this issue so timely!