Hello,

Well I really the general idea of a DateTime::Calc::Namespace, but I think the case of DateTime::Pregnancy (Date::Pregnancy now) really shows the difficulty of generalizing such a thing.

In calculating a date a of birth I currently have knowledge of 3 different methods. They all differ at bit but all calculate from the first day of the last period and from the you can somewhat deduct the conception date.

So the conception date indicating the start of the pregnancy is something, which is not known when initializing the DateTime object calling the constructor. This could of just be documented, but I think it conflicts a bit with the idea of a start and an end, also since the main functionality in Date::Pregnancy is calculating the end date.

So a DateTime::Calculate::Pregnancy could be used to measure the length of a pregnancy for comparison etc. I am not saying that it would be impossible to implement DateTime::Calc::Pregnancy based in Date::Pregnancy, but the world of pregnancy calculation is a bit upside-down compared to normal calendar usage if you get my point.

jonasbn


On 12/10-2004, at 23.05, Rick Measham wrote:

At 11:03 am +0200 2004-10-12, Jonas B.Nielsen wrote:
<snip>
After thinking for a couple of days, seems a new sub-name space for calculations wouldn't be a bad thing. However I'd like to see some sort of generic API. Maybe:

$object = new DateTime::Calc::FooBar(
   start => $dt1
   end   => $dt2
   %options
);


$pregnancy = new DateTime::Calc::Pregnancy( start => $conception_dt, ); $birth_dt = $pregnancy->end;


$pregnancy = new DateTime::Calc::Pregnancy( end => $birth_dt, ); $conception_dt = $pregnancy->start;

<snip>



Reply via email to