pregnancy calculator script

Show 40 post(s) from this thread on one page
Page 1 of 2 12 Last
• 12-03-2013, 02:34 PM
IlonaK
pregnancy calculator script
Hello I need your help in creating a script for that pregnancy calculator please :o

http://www.duedatecalculator.org/free-calculator/
• 12-03-2013, 02:35 PM
JMRKER
So what is wrong with the script provided at the link?
• 12-03-2013, 02:40 PM
IlonaK
I want to translate it into my language
• 12-03-2013, 03:32 PM
IlonaK
• 12-03-2013, 05:03 PM
JMRKER
Sorry, can not help :(
Not a second language for me.
• 12-03-2013, 09:07 PM
\\.\
40 to 42 weeks is considered the normal gestation period and from that you can extrapolate a basic script.

The calculator uses a server-side script to perform its calculations but you can obtain an idea of the parameters by passing the script a number of parameters to obtain an idea of the algorithm that it is using.

Using the following parameters...

December 3 / 2013 and 28 days cycle the script outputs the following information.

Your next menstrual period is expected to start on December 31, 2013.

Your next most fertile period is December 15, 2013 to December 19, 2013.

If you conceive within this timeframe, your estimated due date will be September 09, 2014.

======================

So putting the data in to a spread sheet (for simplicity) I found that they were using 36 weeks as a guide which IMHO is not a good calculation and over simplistic because 252/28 = 9

You have 90 days in a quarter ... 270 days is 9 months, not 252.

I would say that the calculator has a fundamental flaw in two respects, firstly each pregnancy is different and baby comes when its due and the math behind the calculator is not as accurate as it could be.
• 12-06-2013, 06:53 PM
jalarie
Quote:

Originally Posted by IlonaK
Hello I need your help in creating a script for that pregnancy calculator please :o

http://www.duedatecalculator.org/free-calculator/

I did a similar calculator for a lady who was breeding horses, and then expanded the basic idea into a generalized date-jump page at http://spruce.flint.umich.edu/~jalarie/jaa_kch.htm.

If you can give me the names of your months, the number of days in each, and what you feel is a normal gestation period, I can probably do something for you.
• 12-07-2013, 08:28 AM
\\.\
The simplicity of this should be a case of sign posting and letting the OP to get on with it themselves, if they want to learn JS then this is the best way, doing something for someone does not help that person learn does it?

1. You need to grab a date, that would be best using a pull down menu of day / month / year
2. you need to add at least 9 months 2 weeks to that date or rough it out to ((365 / 4) * 3)+14
3 using the javascript setDate() function to add those number of days to the date object generated from the input, you can get a possible DOB.

Job done, only thing needed is a nice header graphic and some CSS.
• 12-07-2013, 08:53 AM
\\.\
In fact, in the time between the last post and this one, I have written a simple routine and also made a cup of coffee..
• 12-07-2013, 11:33 AM
IlonaK
Estimated Fertility between 10-20 days after "first day of last menstrual period"
Estimated Conception Date between 14 days after "first day of last menstrual period"
Estimated Due date 280 days or 40 weeks after "first day of last menstrual period"
This is what I need
For example:
If first day of last menstrual period is: 1/12/13 (dd/mm/yy)
so....
Estimated Fertility: 10/12/13-20/12/13
Estimated Conception Date: 14/12/13
Estimated Due date: 07/09/14
Unfortunately I do not know the language of JS, so I'm asking for your help!
Thank you!
• 12-07-2013, 11:45 AM
jalarie
Quote:

Originally Posted by IlonaK
Estimated Fertility between 10-20 days ... Unfortunately I do not know the language of JS, so I'm asking for your help!
Thank you!

You gave most of what I need to give you help. I don't know the Hebrew month names nor the length of each. I seem to remember that Second-Adar gets to pop in and out "as needed" to really mess things up! I need the details on that.
• 12-07-2013, 12:26 PM
\\.\
I am feeling pretty generous, as you are a beginner, try to work with this as a base and work out what you need to do to get the desired results, this is as close as you are going to get to what you want.

Excuse the translations, you have google to thank for that.

If you need help understanding any of it and why I went down this particular route / method then let me know what it is and I will answer as best I can so you can understand.

The only proviso I have on this is you give some credit and the URL remains in the page.

HTML Code:

```<!DOCTYPE> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>מחשבון הריון על ידי \ \. \</title> <style> textarea,select{direction:rtl;} </style> <script> /*     Script on :     http://www.webdeveloper.com/forum/showthread.php?287245-pregnancy-calculator-script     Based on original script by : \\.\ */ monthName = {        "Jan":"ינואר",                                 "Feb":"פברואר",                                 "Mar":"מרץ",                                 "Apr":"אפריל",                                 "May":"מאי",                                 "Jun":"יוני",                                 "Jul":"יולי",                                 "Aug":"אוגוסט",                                 "Sep":"ספטמבר",                                 "Oct":"אוקטובר",                                 "Nov":"נובמבר",                                 "Dec":"דצמבר"                         } dow = {                 "Sun":"יום ראשון",                 "Mon":"יום שני",                 "Tue":"יום שלישי",                 "Wed":"יום רביעי",                 "Thu":"יום חמישי",                 "Fri":"יום שישי",                 "Sat":"יום שבת"         }                                // get selected date function selectedDate(){ // create a date string that the date object understands         with( document.dateValue ){                 dateStr = [        dayMonth[ dayMonth.selectedIndex ].value,                                         monthName[ monthName.selectedIndex ].value,                                         yearSelect[ yearSelect.selectedIndex ].value                                 ].join(" ");         }// end of with         res = new Date(dateStr+ " 00:00:00"); conceive = res.toUTCString().slice(0,16); // gestation = gestation = ((365/4)*3)+14; // gets days res.setDate( gestation ); birth = res.toUTCString().slice(0,16); // generate a message str = "בהנחה שאתה הגה במועד ניתנו כ "+conceive+" ותקופת ההריון שלך היא "+gestation+" ימים, המועד הצפוי של לידה יהיה סביב "+birth; // replace days of week and month names str = str.replace( conceive.slice(0,3),                dow[ conceive.slice(0,3) ] ); str = str.replace( conceive.slice(8,11),        monthName[ conceive.slice(8,11) ] ); str = str.replace( birth.slice(0,3),                dow[ birth.slice(0,3)] ); str = str.replace( birth.slice(8,11),                monthName[ birth.slice(8,11) ] ); document.dateValue.outputMessage.innerHTML = str; } </script> </head> <body>   <form id="dateValue" name="dateValue" method="post" action="javascript:;" onSubmit="selectedDate(); return false;">     <p>       <select name="dayMonth">         <option>1</option>         <option>2</option>         <option>3</option>         <option>4</option>         <option>5</option>         <option>6</option>         <option>7</option>         <option>8</option>         <option>9</option>         <option>10</option>         <option>11</option>         <option>12</option>         <option>13</option>         <option>14</option>         <option>15</option>         <option>16</option>         <option>17</option>         <option>18</option>         <option>19</option>         <option>20</option>         <option>21</option>         <option>22</option>         <option>23</option>         <option>24</option>         <option>25</option>         <option>26</option>         <option>27</option>         <option>28</option>         <option>29</option>         <option>30</option>         <option>31</option>       </select>       /            <select name="monthName">         <option value="Jan">ינואר</option>         <option value="Feb">פברואר</option>         <option value="Mar">מרץ</option>         <option value="Apr">אפריל</option>         <option value="May">מאי</option>         <option value="Jun">יוני</option>         <option value="Jul">יולי</option>         <option value="Aug">אוגוסט</option>         <option value="Sep">ספטמבר</option>         <option value="Oct">אוקטובר</option>         <option value="Nov">נובמבר</option>         <option value="Dec">דצמבר</option>       </select>       /            <select name="yearSelect">         <option value="2013">2013</option>         <option value="2014">2014</option>         <option value="2015">2015</option>       </select>       <input type="submit" name="Submit" value="Submit" />     </p>     <p>       <textarea name="outputMessage" cols="50" rows="3"></textarea> </p>   </form> </body> </html>```
Is that any good to you?
• 12-07-2013, 01:16 PM
IlonaK
Thank you! But the calculator is not accurate.
I compare the different pregnancy calculator and the results are different.
Overall difference between first menstrual date to Birth date is 280 days. Why you use 287.75 days?
• 12-07-2013, 05:03 PM
\\.\
pregnancies are not to the exact date and the average pregnancy is 9 months hence the 365 / 4 then * 3 = 9 months in days + 14 days to give a margin of error.

295 days according to this site.

Its a case of using an average, baby will arrive when baby is ready.
• 12-07-2013, 11:10 PM
jalarie
I don't have the Hebrew information, yet, so I tried one in English:

http://spruce.flint.umich.edu/~jalarie/jaa_kch3.htm

What do you think?
Show 40 post(s) from this thread on one page
Page 1 of 2 12 Last

X vBulletin 4.2.2 Debug Information

• Page Generation 0.15378 seconds
• Memory Usage 2,433KB
• Queries Executed 11 (?)
Template Usage (24):
• (1)bbcode_html_printable
• (2)bbcode_quote_printable
• (1)footer
• (1)gobutton
• (1)navbar_moderation
• (1)navbar_noticebit
• (2)option
• (1)pagenav
• (1)pagenav_curpage
• (1)spacer_close
• (1)spacer_open

Phrase Groups Available (3):
• global
• postbit
Included Files (19):
• ./global.php
• ./includes/class_bootstrap.php
• ./includes/init.php
• ./includes/class_core.php
• ./includes/config.php
• ./includes/functions.php
• ./includes/class_friendly_url.php
• ./includes/class_hook.php
• ./includes/class_bootstrap_framework.php
• ./vb/vb.php
• ./vb/phrase.php
• ./includes/functions_calendar.php
• ./includes/class_bbcode_alt.php
• ./includes/class_bbcode.php
• ./includes/functions_bigthree.php
• ./includes/functions_notice.php

Hooks Called (43):
• init_startup
• init_startup_session_setup_start
• database_pre_fetch_array
• database_post_fetch_array
• init_startup_session_setup_complete
• global_bootstrap_init_start
• global_bootstrap_init_complete
• cache_permissions
• fetch_foruminfo
• global_state_check
• global_bootstrap_complete
• global_start
• style_fetch
• global_setup_complete
• friendlyurl_resolve_class
• friendlyurl_clean_fragment
• friendlyurl_geturl
• pagenav_page
• cache_templates
• cache_templates_process
• template_register_var
• template_render_output
• fetch_template_start
• fetch_template_complete
• parse_templates