.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Date::Pregnancy 3pm" .TH Date::Pregnancy 3pm "2016-02-16" "perl v5.22.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Date::Pregnancy \- calculate birthdate and week numbers for a pregnancy .SH "VERSION" .IX Header "VERSION" This documentation describes version 0.05 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Date::Pregnancy qw(calculate_birthday); \& \& my $dt = DateTime\->new( \& year => 2004, \& month => 3, \& day => 19, \& ); \& $birthday = calculate_birthday(first_day_of_last_period => $dt); \& \& $birthday = calculate_birthday( \& first_day_of_last_period => $dt, \& period_cycle_length => 28, \& ); \& \& \& use Date::Pregnancy qw(calculate_week); \& \& $week = calculate_week(first_day_of_last_period => $dt); \& \& $dt2 = DateTime\->new( \& year => 2004, \& month => 12, \& day => 24, \& ); \& \& $week = calculate_week( \& first_day_of_last_period => $dt, \& date => $dt2, \& ); \& \& $week = calculate_week( \& first_day_of_last_period => $dt, \& method => \*(Aq40weeks\*(Aq, \& ); \& \& \& $week = calculate_week(birthday => $birthday); \& \& \& use Date::Pregnancy qw(calculate_month); \& \& $month = calculate_month(first_day_of_last_period => $dt); \& \& $month = calculate_month( \& first_day_of_last_period => $dt, \& date => $dt2, \& ); \& \& $month = calculate_month( \& first_day_of_last_period => $dt, \& method => \*(Aqcountback\*(Aq, \& ); \& \& $week = calculate_month(birthday => $birthday); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module can be used to calculate the due date for a pregnancy, it implements 3 different methods, which will give different results. .PP The different methods are described below in detail (\s-1SEE: METHODS\s0). .PP This module relies heavily on DateTime objects in order to calculate dates of birth, week numbers and month numbers. It does however not require Michael Schwern's module Sex. .SS "calculate_birthday" .IX Subsection "calculate_birthday" Calculates date of birth. .PP Takes one named parameter: .PP * first_day_of_last_period .PP Which should be a DateTime object indicating the first day of the last period. .PP If the period cycle length varies from the average of 28 days, you can optionally provide the named parameter: .PP * period_cycle_length .PP This defaults to 28. .PP The default method used for calculating date of birth is the 266 days method (\s-1SEE:\s0 Methods). If you want to use one of the other methods you can use the named parameter \fBmethod\fR and specify either: .PP * 40weeks .PP * countback .PP The function returns a DateTime object indicating the calculated date of birth or undef upon failure. .SS "calculate_week" .IX Subsection "calculate_week" Calculates in what week the pregnant person currently is. A pregnancy is on average 40 weeks; these week numbers are normally used when talking pregnancy and most guides, books and websites refer to the different stages of pregnancy using these week numbers. .PP Takes one named parameter: .PP * first_day_of_last_period .PP Which should be a DateTime object indicating the first day of the last period. .PP Optionally you can provide it with a named \fBdate\fR parameter if you want to calculate the week number for a given date. The date specified should be a DateTime object, this defaults to now, when not provided. .PP Also a named parameter called \fBbirthday\fR can be provided, if you already have a birthday DateTime object. If this is not provided \&\fBcalculate_week\fR will call \fBcalculate_birthday\fR internally. .PP As for \fBcalculate_birthday\fR the function also takes the named parameter: .PP * first_day_of_last_period .PP and .PP * method .PP Please refer to \fBcalculate_birthday\fR. .PP The function returns an integer indicating the week of the pregnancy or undef upon failure. .SS "calculate_month" .IX Subsection "calculate_month" Calculates in what month the pregnant person currently is (see also \&\fBcalculate_week\fR). A pregnancy is on average 9 months. .PP Takes one named parameter: .PP * first_day_of_last_period .PP Which should be a DateTime object indicating the first day of the last period. .PP Optionally you can provide it with a named \fBdate\fR parameter if you want to calculate the month number for a given date. The date specified should be a DateTime object, this defaults to now, when not provided. .PP Also a named parameter called \fBbirthday\fR can be provided, as for \&\fBcalculate_week\fR, if you already have a birthday DateTime object. If this is not provided \fBcalculate_month\fR will call \fBcalculate_birthday\fR internally. .PP As for \fBcalculate_birthday\fR the function also takes the named parameter: .PP * first_day_of_last_period .PP and .PP * method .PP Please refer to \fBcalculate_birthday\fR. .PP The function returns an integer indicating the month of the pregnancy or undef upon failure. .SH "METHODS" .IX Header "METHODS" This module implements 3 different methods for calculating the date of birth based on data such as first day of last period (\s-1LMP\s0) and average period cycle length (\s-1APCL\s0). .PP The 3 methods are: .IP "266 Days (the one used by default)" 4 .IX Item "266 Days (the one used by default)" .PD 0 .IP "40 Weeks" 4 .IX Item "40 Weeks" .IP "Count Back" 4 .IX Item "Count Back" .PD .SS "266 Days" .IX Subsection "266 Days" This method uses the \s-1APCL\s0 together with the \s-1LMP.\s0 .PP It adds the \s-1APCL\s0 divided by 2 to the \s-1LMP\s0 in the case where \s-1APCL\s0 is equal to or lower than the average of 28 days. .PP In the case where the \s-1APCL\s0 is higher than the average it adds the \s-1APCL\s0 multiplied by 0.85 multiplied by 2 divided by 3 to the \s-1LMP.\s0 .SS "40 Weeks" .IX Subsection "40 Weeks" This method does not use the \s-1APCL,\s0 but simply counts 40 weeks, the number of weeks in an average pregnancy from the \s-1LMP\s0 date. .SS "Count Back" .IX Subsection "Count Back" The count back method adds 7 days to the \s-1LMP,\s0 then deducts 3 months, and finally adds 1 year to give the estimated date of birth. .SH "TEST DATA" .IX Header "TEST DATA" I am very interested in improving this module, so if you have the opportunity of submitting me test data it is more than welcome. .PP The format should be either a test file (*.t), where you choose the file name yourself (see t/Villads.t) or you simply submit me the date of the first day of the last period for the pregnant person, the length of time between periods (if this varies from the avarage of 28), and possibly the result of your own/your doctor's week number calculation. I can then use these data to validate the calculation methods used in this module. .PP If possible please include the information on what method your doctor is using if this is available (\s-1SEE: METHODS\s0). .SH "BUGS" .IX Header "BUGS" Please report issues via \s-1CPAN RT:\s0 .PP .Vb 1 \& http://rt.cpan.org/NoAuth/Bugs.html?Dist=Date\-Pregnancy .Ve .PP or by sending mail to .PP .Vb 1 \& bug\-Date\-Pregnancy@rt.cpan.org .Ve .PP See the \s-1BUGS\s0 file for known bugs. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "DateTime" 4 .IX Item "DateTime" .PD 0 .IP "Sex" 4 .IX Item "Sex" .IP "Time::Clock::Biological" 4 .IX Item "Time::Clock::Biological" .IP "" 4 .IX Item "" .IP "" 4 .IX Item "" .IP "" 4 .IX Item "" .PD .SH "DISCLAIMER" .IX Header "DISCLAIMER" The method of calculating day of birth and week numbers implemented in this module is based on simple formulas. .PP The ultrasound scan is a much more accurate method and finally babies seem to have a will of their own, so please do only use the results of this module as a guideline, the author of this module cannot be held responsible for the results of calculations based on use of this module. .PP Feedback is welcome though as well as test data (please see \s-1TEST DATA\s0 above). .SH "ACKNOWLEDGEMENTS" .IX Header "ACKNOWLEDGEMENTS" .IP "\(bu" 4 Nick Morrott, corrections to multiple spelling errors .IP "\(bu" 4 Thomas Eibner, who \s-1ALWAYS\s0 asks me whether I am a father by now and acuses me of pregnant-talk (just because he cannot calculate the weeks), now he can find out by looking at the tests included in this module or by using this module. .IP "\(bu" 4 Lars Balker Rasmussen, who could not find Date-Pregnancy in his include path \*(L"lbr can't locate Date/Pregnancy.pm in \f(CW@INC\fR\*(R" \- Now he has no excuse Date::Pregnancy is a reality. .IP "\(bu" 4 Lars Thegler for making me revisit the alpha version. .SH "AUTHOR" .IX Header "AUTHOR" Jonas B. Nielsen, (jonasbn) \- \f(CW\*(C`\*(C'\fR .SH "COPYRIGHT" .IX Header "COPYRIGHT" Date-Pregnancy is (C) by Jonas B. Nielsen, (jonasbn) 2004\-2016 .PP Date-Pregnancy is released under the artistic license 2.0