[Chicago-talk] Calculating Holidays

Joel Berger joel.a.berger at gmail.com
Thu Jul 12 18:45:56 PDT 2012


I tried this using a free web service, and I got right to the point of
dealing with DateTime math, so I leave that to you :-)

The webservice is at http://www.holidaywebservice.com
my code is at https://gist.github.com/3102219

All it does now is get the holidays this month. From there, after
deciding if you have passed the last one, add a month and request
again. Repeat as needed.

Hope this helps,
Joel

On Thu, Jul 12, 2012 at 7:53 PM, Jay Strauss <me at heyjay.com> wrote:
> Richard, I get the feeling you are looking for a module with built in
> knowledge of the dates of various holidays.  I'm not sure if such a
> thing exists. (admittedly I haven't searched)
>
> The docs for DateTime::Event::Holiday::US; seem like it just a module
> for naming dates and proving a wrapper to the underlying  modules
>
> I think you need a module that let's you supply a calendar (dates with
> names) and then gives you functions for navigating that calendar
>
>
> Thanks
> Jay
>
> Sent from my iPhone
>
> On Jul 12, 2012, at 12:34 PM, Richard Reina <richard at rushlogistics.com> wrote:
>
>>
>> Hi Mike,
>>
>> Thank you very much for the suggestion.  With some difficulty I was able to get the module installed. However, I am unclear on how it works.  The example given in the docs:
>>
>> use DateTime::Event::Holiday::US;
>>
>> my $thanksgiving = DateTime::Event::Holiday::US::holiday( 'Thanksgiving' );
>>
>>
>> gives me a hash reference which when I try to dereference with:
>>
>> my %hash =  %$thanksgiving;
>>
>> foreach my $k (keys %hash) {
>>        print "$k: $hash{$k}\n";
>>    }
>>
>>
>> gives me:
>>
>> as_ical: ARRAY(0x1e63190)
>> set: Too complex
>>
>> I was hoping it might give me the date for Thanksgiving.
>>
>> If any one can give me an idea as to what I am doing wrong in trying to use this module I would really appreciate it.
>>
>> Thanks,
>>
>> Richard
>>
>>
>>
>>>
>>> Mike Fragassi <mikefrag at gmail.com> wrote:
>>
>>> Try DateTime::Event::Holiday::US.
>>
>>> On Jul 3, 2012 3:46 PM, <richard at rushlogistics.com> wrote:
>>>
>>> I am lost trying to write a simple script that tells
>>> me how many days until the next approaching holiday.
>>> has anyone ever done anything similar or know of anything
>>> helpful. I've looked at Date::Manip but that still
>>> leaves me with the cumbersome task of finding out
>>> which holiday is the next one from a given date.
>>>
>>> Any help would be appreciated as not solving it will
>>> keep me preoccupied all through the holiday.
>>>
>>> Thanks
>>>
>>> Richard
>>> _______________________________________________
>>> Chicago-talk mailing list
>>> Chicago-talk at pm.org
>>> http://mail.pm.org/mailman/listinfo/chicago-talk
>>
>>
>> --
>> Richard Reina
>> Rush Logistics, Inc.
>> Watch our 3 minute movie:
>> http://www.rushlogistics.com/movie
>>
>> _______________________________________________
>> Chicago-talk mailing list
>> Chicago-talk at pm.org
>> http://mail.pm.org/mailman/listinfo/chicago-talk
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk


More information about the Chicago-talk mailing list