Originally Posted by glenngv
Why do you prompt for month name instead of just month number? Typing text is more error prone compared to numbers.
If you prompt for numeric birth month, then the date of birth could be easily created.
var dob = new Date(birthYear, birthMonth - 1, birthDay);
Of course, you have to validate the inputs to ensure the valid values are entered.
Hi again Glenn,
This is what I came up with and it seems to work:
var months = 'janfebmaraprmayjunjulaugsepoctnovdec';
var Pl = 3.14159265358979323846;
var milliseconds = 1000*60*60*24;
var interllectualCycle = 33;
var emotionalCycle = 28;
var physicalCycle = 23;
var birthYear = prompt( 'Enter year of birth as a 4 digit integer');
//alert('Your year of birth is '+ birthYear);
var birthMonth = prompt( 'Enter the name of the month of birth' );
var pos = months.indexOf( birthMonth.substring( 0, 3 ).toLowerCase() );
//alert( 'Month number: ' + ( 1 + pos / 3 ) );
var birthDay = prompt( 'Enter day of birth as an integer ');
var yearString = birthYear;
var monthNumber = pos;
var dayString = birthDay;
//the date object is created like so:
var myBirthday = new Date(yearString - 1, monthNumber, dayString);
alert ('myBirthday' + myBirthday);
//now a date object is contained in the variable called myBirthday
Does it look the way it should?