ah, cool. Missed that. Thanks. The pain in returning a Nullable{Date} is
that now I have to unpack it for things like dayofyear(). Nullable
introduces a rat's nest of unnecessary complications.
On Mon, Feb 8, 2016 at 7:35 PM, Christopher Alexander <[email protected]>
wrote:
> For a null date, I usually just use Date() (Dates.Date()), which returns
> Jan 1, 0001. Also, you know that there is already a method to check
> whether or not a year is a leap year right?
>
> Dates.isleapyear(y), returns a Bool.
> http://docs.julialang.org/en/release-0.4/manual/dates/
>
>
> On Monday, February 8, 2016 at 10:08:25 PM UTC-5, Michael Landis wrote:
>>
>> I'm so confused....
>>
>> I thought this would be cool:
>> isLeapYr(yr::Int64) = yr % 400 == 0 || (yr % 4 == 0 && yr % 100 != 0)
>> LeapDay(yr) = isLeapYr(yr) ? Date(yr,2,29) : Nullable{Date}()
>>
>> lp15 = LeapDay(2015) --> Nullable{Date}()
>> lp16 = LeapDay(2016) --> 2016-02-29
>>
>> no surprises there, but when I test the return values ...
>>
>> isnull( lp15 ) --> true
>> isnull( lp16 ) --> MethodError: `isnull` has no method matching isnull(
>> ::Date )
>>
>> What IS the secret Nullable{Date} formulation?
>>
>