Re: [julia-users] MethodError: '+' has no method matching +(::DateTime, ::Int64)
Le lundi 04 avril 2016 à 11:03 -0600, Jacob Quinn a écrit : > Sorry, I should have been more clear. > > I was trying to express that perhaps we should document these > previously-internal methods so that they are actually a part of the > official interface/exported. They're not unsafe or anything and > people may actually have a use for these, so maybe we should just > document to everythings more clear. OK. However, supporting day(::Integer) increases the chances that people will confuse day() and Day(), as in the current thread. In general, I think it would be clearer to require the caller to create a Date object from Rata Die days, and then use the standard Date API. Since Date is immutable, the creation of the object will be optimized out where possible. BTW, is there any reason why we have both day() and dayofmonth(), but not week() and weekofyear()? SQL provides both. I'd say we should either follow it in duplicating functions, or not have any duplicates at all. Regards > On Mon, Apr 4, 2016 at 10:49 AM, Milan Bouchet-Valat wrote: > > Le lundi 04 avril 2016 à 10:27 -0600, Jacob Quinn a écrit : > > > Hmmm.yeah, it's not ideal, I guess. Dates.day(::Integer) is > > > indeed an internal method that takes the # of Rata Die days (i.e. the > > > value of Int(Date(2015,1,1))) and returns the day of the month for > > > that Rata Die. It might be worth documenting so that it's more clear > > > what's going on when people search/help it. > > If these methods are internal, they shouldn't be added to exported > > functions. A useful convention is to prefix these with an underscore. > > > > > > Regards > > > > > > > -Jacob > > > > > > On Mon, Apr 4, 2016 at 10:02 AM, Josh Langsfeld > > > wrote: > > > > Shouldn’t Dates.day(1) be the MethodError here? It calls what > > > > appears to be an internal calculation method that happens to have > > > > the same name as the exported and documented method. > > > > > > > > On Monday, April 4, 2016 at 11:21:47 AM UTC-4, Jacob Quinn wrote: > > > > > > > > > Dates.day is the accessor funciton, returning the day of month > > > > > for a Date/DateTime. > > > > > > > > > > Dates.Day is the Period type representing the span of one day. > > > > > > > > > > So you'll want something like: > > > > > > > > > > now() + Dates.Day(1) > > > > > > > > > > -Jacob > > > > > > > > > > > > > > > On Mon, Apr 4, 2016 at 5:48 AM, Joshwrote: > > > > > > When trying to increment and decrement dates I get the method > > > > > > error stated above. > > > > > > > > > > > > For example with: now() + Dates.day(1) > > > > > > > > > > > > I get the error: > > > > > > > > > > > > ERROR: MethodError: `+` has no method matching +(::DateTime, > > > > > > ::Int64) > > > > > > Closest candidates are: > > > > > > +(::Any, ::Any, ::Any, ::Any...) > > > > > > +(::Int64, ::Int64) > > > > > > +(::Complex{Bool}, ::Real) > > > > > > ... > > > > > > > > > > > > But with doing something like this: Date(2015,12,25) - today() > > > > > > > > > > > > I get the correct result with no error. > > > > > > > > > > > > Any ideas? > > > > > > Thanks > > > > > > > > > > > > > > > > > > >
Re: [julia-users] MethodError: '+' has no method matching +(::DateTime, ::Int64)
Sorry, I should have been more clear. I was trying to express that perhaps we should document these previously-internal methods so that they are actually a part of the official interface/exported. They're not unsafe or anything and people may actually have a use for these, so maybe we should just document to everythings more clear. On Mon, Apr 4, 2016 at 10:49 AM, Milan Bouchet-Valatwrote: > Le lundi 04 avril 2016 à 10:27 -0600, Jacob Quinn a écrit : > > Hmmm.yeah, it's not ideal, I guess. Dates.day(::Integer) is > > indeed an internal method that takes the # of Rata Die days (i.e. the > > value of Int(Date(2015,1,1))) and returns the day of the month for > > that Rata Die. It might be worth documenting so that it's more clear > > what's going on when people search/help it. > If these methods are internal, they shouldn't be added to exported > functions. A useful convention is to prefix these with an underscore. > > > Regards > > > > -Jacob > > > > On Mon, Apr 4, 2016 at 10:02 AM, Josh Langsfeld > > wrote: > > > Shouldn’t Dates.day(1) be the MethodError here? It calls what > > > appears to be an internal calculation method that happens to have > > > the same name as the exported and documented method. > > > > > > On Monday, April 4, 2016 at 11:21:47 AM UTC-4, Jacob Quinn wrote: > > > > > > > Dates.day is the accessor funciton, returning the day of month > > > > for a Date/DateTime. > > > > > > > > Dates.Day is the Period type representing the span of one day. > > > > > > > > So you'll want something like: > > > > > > > > now() + Dates.Day(1) > > > > > > > > -Jacob > > > > > > > > > > > > On Mon, Apr 4, 2016 at 5:48 AM, Josh wrote: > > > > > When trying to increment and decrement dates I get the method > > > > > error stated above. > > > > > > > > > > For example with: now() + Dates.day(1) > > > > > > > > > > I get the error: > > > > > > > > > > ERROR: MethodError: `+` has no method matching +(::DateTime, > > > > > ::Int64) > > > > > Closest candidates are: > > > > > +(::Any, ::Any, ::Any, ::Any...) > > > > > +(::Int64, ::Int64) > > > > > +(::Complex{Bool}, ::Real) > > > > > ... > > > > > > > > > > But with doing something like this: Date(2015,12,25) - today() > > > > > > > > > > I get the correct result with no error. > > > > > > > > > > Any ideas? > > > > > Thanks > > > > > > > > > > > > > > >
Re: [julia-users] MethodError: '+' has no method matching +(::DateTime, ::Int64)
Le lundi 04 avril 2016 à 10:27 -0600, Jacob Quinn a écrit : > Hmmm.yeah, it's not ideal, I guess. Dates.day(::Integer) is > indeed an internal method that takes the # of Rata Die days (i.e. the > value of Int(Date(2015,1,1))) and returns the day of the month for > that Rata Die. It might be worth documenting so that it's more clear > what's going on when people search/help it. If these methods are internal, they shouldn't be added to exported functions. A useful convention is to prefix these with an underscore. Regards > -Jacob > > On Mon, Apr 4, 2016 at 10:02 AM, Josh Langsfeld> wrote: > > Shouldn’t Dates.day(1) be the MethodError here? It calls what > > appears to be an internal calculation method that happens to have > > the same name as the exported and documented method. > > > > On Monday, April 4, 2016 at 11:21:47 AM UTC-4, Jacob Quinn wrote: > > > > > Dates.day is the accessor funciton, returning the day of month > > > for a Date/DateTime. > > > > > > Dates.Day is the Period type representing the span of one day. > > > > > > So you'll want something like: > > > > > > now() + Dates.Day(1) > > > > > > -Jacob > > > > > > > > > On Mon, Apr 4, 2016 at 5:48 AM, Josh wrote: > > > > When trying to increment and decrement dates I get the method > > > > error stated above. > > > > > > > > For example with: now() + Dates.day(1) > > > > > > > > I get the error: > > > > > > > > ERROR: MethodError: `+` has no method matching +(::DateTime, > > > > ::Int64) > > > > Closest candidates are: > > > > +(::Any, ::Any, ::Any, ::Any...) > > > > +(::Int64, ::Int64) > > > > +(::Complex{Bool}, ::Real) > > > > ... > > > > > > > > But with doing something like this: Date(2015,12,25) - today() > > > > > > > > I get the correct result with no error. > > > > > > > > Any ideas? > > > > Thanks > > > > > > > > > > >
Re: [julia-users] MethodError: '+' has no method matching +(::DateTime, ::Int64)
Hmmm.yeah, it's not ideal, I guess. Dates.day(::Integer) is indeed an internal method that takes the # of Rata Die days (i.e. the value of Int(Date(2015,1,1))) and returns the day of the month for that Rata Die. It might be worth documenting so that it's more clear what's going on when people search/help it. -Jacob On Mon, Apr 4, 2016 at 10:02 AM, Josh Langsfeldwrote: > Shouldn’t Dates.day(1) be the MethodError here? It calls what appears to > be an internal calculation method that happens to have the same name as the > exported and documented method. > > On Monday, April 4, 2016 at 11:21:47 AM UTC-4, Jacob Quinn wrote: > > Dates.day is the accessor funciton, returning the day of month for a >> Date/DateTime. >> >> Dates.Day is the Period type representing the span of one day. >> >> So you'll want something like: >> >> now() + Dates.Day(1) >> >> -Jacob >> >> >> On Mon, Apr 4, 2016 at 5:48 AM, Josh wrote: >> >>> When trying to increment and decrement dates I get the method error >>> stated above. >>> >>> For example with: now() + Dates.day(1) >>> >>> I get the error: >>> >>> *ERROR: MethodError: `+` has no method matching +(::DateTime, ::Int64)* >>> >>> Closest candidates are: >>> >>> +(::Any, ::Any, *::Any*, *::Any...*) >>> >>> +(*::Int64*, ::Int64) >>> >>> +(*::Complex{Bool}*, ::Real) >>> >>> ... >>> >>> But with doing something like this: Date(2015,12,25) - today() >>> >>> I get the correct result with no error. >>> >>> Any ideas? >>> Thanks >>> >>> >> >
Re: [julia-users] MethodError: '+' has no method matching +(::DateTime, ::Int64)
Shouldn’t Dates.day(1) be the MethodError here? It calls what appears to be an internal calculation method that happens to have the same name as the exported and documented method. On Monday, April 4, 2016 at 11:21:47 AM UTC-4, Jacob Quinn wrote: Dates.day is the accessor funciton, returning the day of month for a > Date/DateTime. > > Dates.Day is the Period type representing the span of one day. > > So you'll want something like: > > now() + Dates.Day(1) > > -Jacob > > > On Mon, Apr 4, 2016 at 5:48 AM, Josh> wrote: > >> When trying to increment and decrement dates I get the method error >> stated above. >> >> For example with: now() + Dates.day(1) >> >> I get the error: >> >> *ERROR: MethodError: `+` has no method matching +(::DateTime, ::Int64)* >> >> Closest candidates are: >> >> +(::Any, ::Any, *::Any*, *::Any...*) >> >> +(*::Int64*, ::Int64) >> >> +(*::Complex{Bool}*, ::Real) >> >> ... >> >> But with doing something like this: Date(2015,12,25) - today() >> >> I get the correct result with no error. >> >> Any ideas? >> Thanks >> >> >
Re: [julia-users] MethodError: '+' has no method matching +(::DateTime, ::Int64)
Dates.day is the accessor funciton, returning the day of month for a Date/DateTime. Dates.Day is the Period type representing the span of one day. So you'll want something like: now() + Dates.Day(1) -Jacob On Mon, Apr 4, 2016 at 5:48 AM, Joshwrote: > When trying to increment and decrement dates I get the method error stated > above. > > For example with: now() + Dates.day(1) > > I get the error: > > *ERROR: MethodError: `+` has no method matching +(::DateTime, ::Int64)* > > Closest candidates are: > > +(::Any, ::Any, *::Any*, *::Any...*) > > +(*::Int64*, ::Int64) > > +(*::Complex{Bool}*, ::Real) > > ... > > But with doing something like this: Date(2015,12,25) - today() > > I get the correct result with no error. > > Any ideas? > Thanks > >
[julia-users] MethodError: '+' has no method matching +(::DateTime, ::Int64)
When trying to increment and decrement dates I get the method error stated above. For example with: now() + Dates.day(1) I get the error: *ERROR: MethodError: `+` has no method matching +(::DateTime, ::Int64)* Closest candidates are: +(::Any, ::Any, *::Any*, *::Any...*) +(*::Int64*, ::Int64) +(*::Complex{Bool}*, ::Real) ... But with doing something like this: Date(2015,12,25) - today() I get the correct result with no error. Any ideas? Thanks