Re: Contributing to DateTime::Event

[email protected] ("Flavio S. Glock")
Newsgroups perl.datetime
Message-ID <[email protected]>
2008/8/27 Kristian Flint <[email protected]>:
> Hi everybody,
>
> I've not been using DateTime for very long and got recommended it by our
> hosting partners, really happy with it etc... But I've come across a
> situation where I want to do something standardish with it and there
> doesn't seem to be any provision for it. The reason I'm mailing the list
> is that I'm amazed no-one has done this before which is leading me to a
> suspicion that there's a good reason why!
>
> So, what I want to do is get the the Bank Holidays for the UK and a few
> other methods like 'is_this_a_bank_holiday( $dt )' or perhaps something
> like 'number_of_working_days_in( $dt1, $dt2 )' to take into account
> weekends. And so on as the project I'm working on requires.
> Now, the reason I think this is possible is that looking at:
> http://www.berr.gov.uk/employment/bank-public-holidays/index.html
> The dates don't appear to be particularly random (they all have v.simple
> rules) and the only dates I don't really understand, the easter ones,
> I'm planning on using DateTime::Event::Easter to help me out.
>
> Is there anything obvious anyone can see that I'm missing, or any
> problems with doing this? I'd imagine I'd call this module
> DateTime::Event::BankHolidays::UK|England but I'm getting a bit ahead of
> myself now.
>
> Ta,
>
> Kristian
>

Kristian:

I'd create DateTime::Event::ICal objects for the non-easter dates.
Dt::E::ICal creates DateTime::Set objects, which provide several
methods you might need.
Dt::E::Easter also creates Dt::Set objects, and you can do a 'union'
of sets to complete your calendar.

Please take a look at the docs. I'd be glad to help if you have problems.

Flávio S. Glock
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.