quinnj / Datetime.jl

A Date and DateTime implementation for Julia; Now deprecated in favor of https://github.com/quinnj/Dates.jl
Other
20 stars 15 forks source link

Date objects aren't serializable #44

Closed StefanKarpinski closed 10 years ago

StefanKarpinski commented 10 years ago
julia> using Datetime

julia> sprint(io->serialize(io,date(2013,7,2)))
ERROR: no method write(IOBuffer, Date{ISOCalendar})
 in serialize at serialize.jl:288
 in anonymous at none:1
 in sprint at io.jl:460
 in sprint at io.jl:464
quinnj commented 10 years ago

This seems to not be a problem in the new package.

In  [2]: using Dates

In  [3]: sprint(io->serialize(io,date(2013,7,2)))

Out [3]: ERROR: date not defined
while loading In[3], in expression starting on line 1
 in anonymous at In[3]:1

In  [4]: sprint(io->serialize(io,Date(2013,7,2)))

Out [4]: "\x11\x01\x02\x04Date#\x14\x01\x02\x05Dates/\x7f\x11\x01\x02\tUTInstant#\x14\x01\x02\x05Dates\x14\x01\x11\0\x02\x03Day#\x14\x01\x02\x05Dates/\x7f\x11\x01\x02\x03Day#\x14\x01\x02\x05Dates/\x7f\x11\x01\x02\x05Int64#\x14\x01\x02\x04Core/K7\v\0\0\0\0\0"

Since the old Date{ISOCalendar} is a bitstype, how do I make it serializable?

StefanKarpinski commented 10 years ago

How rough is the transition from the old to the new package? I'm dealing with a codebase that uses Datetime extensively and don't want to do anything super disruptive.

quinnj commented 10 years ago

Probably not very disruptive (depending on what you're actually using). The main difference is date() => Date(). I'm happy to firedrill any questions/bugs if needed. You can get the new package by Pkg.clone("https://github.com/karbarcca/Dates.jl.git")

quinnj commented 10 years ago

Did you give the new package a spin? I'd love to hear if you ran into any issues. I've mainly been adding a ton more tests over the last few weeks (enjoying finally getting around to using the code coverage tool). I feel like the core code is very stable these days. The main things on my agenda are ironing out some of the new Range issues, doing another pass over date parsing, and trying to tackle the "parameter" issue again (include Calendar/TimeZone as parameter? set them as globals?)

StefanKarpinski commented 10 years ago

Closed by https://github.com/karbarcca/Datetime.jl/pull/45