{"id":18909977,"url":"https://github.com/jonasbn/perl-date-pregnancy","last_synced_at":"2026-06-06T15:01:32.783Z","repository":{"id":19245952,"uuid":"22481196","full_name":"jonasbn/perl-date-pregnancy","owner":"jonasbn","description":"Release history of Date-Pregnancy","archived":false,"fork":false,"pushed_at":"2025-05-25T17:09:58.000Z","size":88,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-05-04T14:42:15.021Z","etag":null,"topics":["cpan","hacktoberfest","perl","perl5"],"latest_commit_sha":null,"homepage":"https://metacpan.org/pod/Date::Pregnancy","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonasbn.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2014-07-31T19:03:26.000Z","updated_at":"2025-05-25T17:09:41.000Z","dependencies_parsed_at":"2024-02-22T19:46:26.670Z","dependency_job_id":"f7bc1c80-7aef-42ce-9a52-6640576f5945","html_url":"https://github.com/jonasbn/perl-date-pregnancy","commit_stats":null,"previous_names":["jonasbn/date-pregnancy"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/jonasbn/perl-date-pregnancy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonasbn%2Fperl-date-pregnancy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonasbn%2Fperl-date-pregnancy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonasbn%2Fperl-date-pregnancy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonasbn%2Fperl-date-pregnancy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonasbn","download_url":"https://codeload.github.com/jonasbn/perl-date-pregnancy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonasbn%2Fperl-date-pregnancy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33986901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-06T02:00:07.033Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpan","hacktoberfest","perl","perl5"],"created_at":"2024-11-08T09:38:51.876Z","updated_at":"2026-06-06T15:01:32.740Z","avatar_url":"https://github.com/jonasbn.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CPAN version](https://badge.fury.io/pl/Date-Pregnancy.svg)](http://badge.fury.io/pl/Date-Pregnancy)\n[![Build Status](https://travis-ci.org/jonasbn/perl-date-pregnancy.svg?branch=master)](https://travis-ci.org/jonasbn/perl-date-pregnancy)\n[![Coverage Status](https://coveralls.io/repos/github/jonasbn/Date-Pregnancy/badge.svg?branch=master)](https://coveralls.io/github/jonasbn/Date-Pregnancy?branch=master)\n\n# NAME\n\nDate::Pregnancy - calculate birthdate and week numbers for a pregnancy\n\n# VERSION\n\nThis documentation describes version 0.05\n\n# SYNOPSIS\n\n        use Date::Pregnancy qw(calculate_birthday);\n\n        my $dt = DateTime-\u003enew(\n                year  =\u003e 2004,\n                month =\u003e 3,\n                day   =\u003e 19,\n        );\n        $birthday = calculate_birthday(first_day_of_last_period =\u003e $dt);\n\n        $birthday = calculate_birthday(\n                first_day_of_last_period =\u003e $dt,\n                period_cycle_length      =\u003e 28,\n        );\n\n\n        use Date::Pregnancy qw(calculate_week);\n\n        $week = calculate_week(first_day_of_last_period =\u003e $dt);\n\n        $dt2 = DateTime-\u003enew(\n                year  =\u003e 2004,\n                month =\u003e 12,\n                day   =\u003e 24,\n        );\n\n        $week = calculate_week(\n                first_day_of_last_period =\u003e $dt,\n                date                     =\u003e $dt2,\n        );\n\n        $week = calculate_week(\n                first_day_of_last_period =\u003e $dt,\n                method                   =\u003e '40weeks',\n        );\n\n\n        $week = calculate_week(birthday =\u003e $birthday);\n\n\n        use Date::Pregnancy qw(calculate_month);\n\n        $month = calculate_month(first_day_of_last_period =\u003e $dt);\n\n        $month = calculate_month(\n                first_day_of_last_period =\u003e $dt,\n                date                     =\u003e $dt2,\n        );\n\n        $month = calculate_month(\n                first_day_of_last_period =\u003e $dt,\n                method                   =\u003e 'countback',\n        );\n\n        $week = calculate_month(birthday =\u003e $birthday);\n\n# DESCRIPTION\n\nThis module can be used to calculate the due date for a pregnancy, it implements\n3 different methods, which will give different results.\n\nThe different methods are described below in detail (SEE: METHODS).\n\nThis module relies heavily on DateTime objects in order to calculate\ndates of birth, week numbers and month numbers. It does however not\nrequire Michael Schwern's module [Sex](https://metacpan.org/pod/Sex).\n\n## calculate\\_birthday\n\nCalculates date of birth.\n\nTakes one named parameter:\n\n\\* first\\_day\\_of\\_last\\_period\n\nWhich should be a DateTime object indicating the first day of the last\nperiod.\n\nIf the period cycle length varies from the average of 28 days,\nyou can optionally provide the named parameter:\n\n\\* period\\_cycle\\_length\n\nThis defaults to 28.\n\nThe default method used for calculating date of birth is the 266 days\nmethod (SEE: Methods). If you want to use one of the other methods you\ncan use the named parameter **method** and specify either:\n\n\\* 40weeks\n\n\\* countback\n\nThe function returns a DateTime object indicating the calculated date of birth\nor undef upon failure.\n\n## calculate\\_week\n\nCalculates in what week the pregnant person currently is. A pregnancy\nis on average 40 weeks; these week numbers are normally used when\ntalking pregnancy and most guides, books and websites refer to the\ndifferent stages of pregnancy using these week numbers.\n\nTakes one named parameter:\n\n\\* first\\_day\\_of\\_last\\_period\n\nWhich should be a DateTime object indicating the first day of the last\nperiod.\n\nOptionally you can provide it with a named **date** parameter if you want\nto calculate the week number for a given date. The date specified\nshould be a DateTime object, this defaults to now, when not provided.\n\nAlso a named parameter called **birthday** can be provided, if you\nalready have a birthday DateTime object. If this is not provided\n**calculate\\_week** will call **calculate\\_birthday** internally.\n\nAs for **calculate\\_birthday** the function also takes the named parameter:\n\n\\* first\\_day\\_of\\_last\\_period\n\nand\n\n\\* method\n\nPlease refer to **calculate\\_birthday**.\n\nThe function returns an integer indicating the week of the pregnancy or\nundef upon failure.\n\n## calculate\\_month\n\nCalculates in what month the pregnant person currently is (see also\n**calculate\\_week**). A pregnancy is on average 9 months.\n\nTakes one named parameter:\n\n\\* first\\_day\\_of\\_last\\_period\n\nWhich should be a DateTime object indicating the first day of the last\nperiod.\n\nOptionally you can provide it with a named **date** parameter if you want\nto calculate the month number for a given date. The date specified\nshould be a DateTime object, this defaults to now, when not provided.\n\nAlso a named parameter called **birthday** can be provided, as for\n**calculate\\_week**, if you already have a birthday DateTime object. If\nthis is not provided **calculate\\_month** will call **calculate\\_birthday**\ninternally.\n\nAs for **calculate\\_birthday** the function also takes the named parameter:\n\n\\* first\\_day\\_of\\_last\\_period\n\nand\n\n\\* method\n\nPlease refer to **calculate\\_birthday**.\n\nThe function returns an integer indicating the month of the pregnancy\nor undef upon failure.\n\n# METHODS\n\nThis module implements 3 different methods for calculating the date of\nbirth based on data such as first day of last period (LMP) and average period\ncycle length (APCL).\n\nThe 3 methods are:\n\n- 266 Days (the one used by default)\n- 40 Weeks\n- Count Back\n\n## 266 Days\n\nThis method uses the APCL together with the LMP.\n\nIt adds the APCL divided by 2 to the LMP in the case where APCL is\nequal to or lower than the average of 28 days.\n\nIn the case where the APCL is higher than the average it adds the APCL\nmultiplied by 0.85 multiplied by 2 divided by 3 to the LMP.\n\n## 40 Weeks\n\nThis method does not use the APCL, but simply counts 40 weeks, the\nnumber of weeks in an average pregnancy from the LMP date.\n\n## Count Back\n\nThe count back method adds 7 days to the LMP, then deducts 3 months, and\nfinally adds 1 year to give the estimated date of birth.\n\n# TEST DATA\n\nI am very interested in improving this module, so if you have the\nopportunity of submitting me test data it is more than welcome.\n\nThe format should be either a test file (\\*.t), where you choose the\nfile name yourself (see t/Villads.t) or you simply submit me the date\nof the first day of the last period for the pregnant person, the length of\ntime between periods (if this varies from the avarage of 28), and possibly\nthe result of your own/your doctor's week number calculation. I can\nthen use these data to validate the calculation methods used in this\nmodule.\n\nIf possible please include the information on what method your doctor\nis using if this is available (SEE: METHODS).\n\n# BUGS\n\nPlease report issues via CPAN RT:\n\n    http://rt.cpan.org/NoAuth/Bugs.html?Dist=Date-Pregnancy\n\nor by sending mail to\n\n    bug-Date-Pregnancy@rt.cpan.org\n\nSee the BUGS file for known bugs.\n\n# SEE ALSO\n\n- [DateTime](https://metacpan.org/pod/DateTime)\n- [Sex](https://metacpan.org/pod/Sex)\n- [Time::Clock::Biological](https://metacpan.org/pod/Time::Clock::Biological)\n- [http://www.paternityangel.com/Articles\\_zone/How\\_it\\_happens/How-6.htm](http://www.paternityangel.com/Articles_zone/How_it_happens/How-6.htm)\n- [http://javascript.internet.com/calculators/pregnancy.html](http://javascript.internet.com/calculators/pregnancy.html)\n- [http://www.plus-size-pregnancy.org/figuring.htm](http://www.plus-size-pregnancy.org/figuring.htm)\n\n# DISCLAIMER\n\nThe method of calculating day of birth and week numbers implemented in\nthis module is based on simple formulas.\n\nThe ultrasound scan is a much more accurate method and finally babies\nseem to have a will of their own, so please do only use the results of\nthis module as a guideline, the author of this module cannot be held\nresponsible for the results of calculations based on use of this module.\n\nFeedback is welcome though as well as test data (please see TEST DATA\nabove).\n\n# ACKNOWLEDGEMENTS\n\n- Nick Morrott, corrections to multiple spelling errors\n- Thomas Eibner, who ALWAYS asks me whether I am a father by now\nand acuses me of pregnant-talk (just because he cannot calculate the\nweeks), now he can find out by looking at the tests included in this\nmodule or by using this module.\n- Lars Balker Rasmussen, who could not find Date-Pregnancy in his include\npath \"lbr can't locate Date/Pregnancy.pm in @INC\" - Now he has no\nexcuse [Date::Pregnancy](https://metacpan.org/pod/Date::Pregnancy) is a reality.\n- Lars Thegler for making me revisit the alpha version.\n\n# AUTHOR\n\nJonas B. Nielsen, (jonasbn) - `\u003cjonasbn@cpan.org\u003e`\n\n# COPYRIGHT\n\nDate-Pregnancy is (C) by Jonas B. Nielsen, (jonasbn) 2004-2016\n\nDate-Pregnancy is released under the artistic license 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonasbn%2Fperl-date-pregnancy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonasbn%2Fperl-date-pregnancy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonasbn%2Fperl-date-pregnancy/lists"}