Hybrid View

1. Registered User
Join Date
Dec 2013
Posts
6

pregnancy calculator script

Hello I need your help in creating a script for that pregnancy calculator please

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

2. So what is wrong with the script provided at the link?

3. Registered User
Join Date
Dec 2013
Posts
6
I want to translate it into my language

4. Registered User
Join Date
Dec 2013
Posts
6

5. Sorry, can not help
Not a second language for me.

6. 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.

7. Registered User
Join Date
Nov 2002
Location
Flint, Michigan, USA
Posts
652
Originally Posted by IlonaK
Hello I need your help in creating a script for that pregnancy calculator please

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.

8. 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..

9. 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.

10. Registered User
Join Date
Dec 2013
Posts
6
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!

11. Registered User
Join Date
Nov 2002
Location
Flint, Michigan, USA
Posts
652
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. 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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>מחשבון הריון על ידי \ \. \</title>
<style>
textarea,select{direction:rtl;}
</style>
<script>
/*
Script on :
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>
<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?

13. Registered User
Join Date
Dec 2013
Posts
6
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?

14. Registered User
Join Date
Dec 2013
Posts
6
Nothing to be done
Medicine Average gestational age is 40 weeks. Always count pregnancy by pregnancy wheel. Of course there are women who gives birth before / after this date (like me on 38 weeks!). That is why it is called "Estimated" date!
jalarie thank you!!!

15. 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.

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

"

"

X vBulletin 4.2.2 Debug Information

• Page Generation 0.49803 seconds
• Memory Usage 3,441KB
• Queries Executed 13 (?)
Template Usage (34):
• (1)bbcode_html
• (2)bbcode_quote
• (1)footer
• (1)forumjump
• (1)forumrules
• (1)gobutton
• (15)memberaction_dropdown
• (1)navbar
• (1)navbar_moderation
• (1)navbar_noticebit
• (1)navbar_tabs
• (2)option
• (1)pagenav
• (1)pagenav_curpage
• (15)postbit
• (15)postbit_onlinestatus
• (15)postbit_wrapper
• (1)spacer_close
• (1)spacer_open
• (1)tagbit_wrapper

Phrase Groups Available (6):
• global
• inlinemod
• postbit
• posting
• reputationlevel
Included Files (27):
• ./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/functions_bigthree.php
• ./includes/class_postbit.php
• ./includes/class_bbcode.php
• ./includes/functions_reputation.php
• ./includes/functions_notice.php
• ./packages/vbattach/attach.php
• ./vb/types.php
• ./vb/cache.php
• ./vb/cache/db.php
• ./vb/cache/observer/db.php
• ./vb/cache/observer.php

Hooks Called (73):
• init_startup
• friendlyurl_resolve_class
• 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
• strip_bbcode
• friendlyurl_clean_fragment
• friendlyurl_geturl
• forumjump
• cache_templates
• cache_templates_process
• template_register_var
• template_render_output
• fetch_template_start
• fetch_template_complete
• parse_templates
• notices_check_start
• notices_noticebit
• process_templates_complete
• friendlyurl_redirect_canonical
• pagenav_page
• pagenav_complete
• bbcode_fetch_tags
• bbcode_create
• postbit_factory
• postbit_display_start
• postbit_imicons
• bbcode_parse_start
• bbcode_parse_complete_precache
• bbcode_parse_complete
• postbit_display_complete
• memberaction_dropdown
• tag_fetchbit_complete
• forumrules
• navbits
• navbits_complete