[Jspro-cvs] jsPro date.js,1.8,1.9
Brought to you by:
wigleys
From: <gat...@us...> - 2003-10-27 07:53:46
|
Update of /cvsroot/jspro/jsPro In directory sc8-pr-cvs1:/tmp/cvs-serv3035 Modified Files: date.js Log Message: QA: methods released in R3 now QA'd Index: date.js =================================================================== RCS file: /cvsroot/jspro/jsPro/date.js,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** date.js 1 Oct 2003 10:02:14 -0000 1.8 --- date.js 27 Oct 2003 07:50:48 -0000 1.9 *************** *** 478,490 **** /** ! * Returns the number of days in the year for this date as either 365 or 366. * * @summary days in year * @author Stuart Wigley ! * @version 1.0, 12/01/03 * @interface <code>Date.getDaysInYear()</code> * @requires <code>Date.isLeapYear()</code> * @return the number of days in the year for this date as either ! * 365 or 366 * @return <code>null</code> if an exception is encountered * @throws IllegalArgumentException --- 478,492 ---- /** ! * Returns the number of days in the year for this date as either '365' or ! * '366'. * * @summary days in year * @author Stuart Wigley ! * @author Randolph Fielding ! * @version 1.1, 10/27/03 * @interface <code>Date.getDaysInYear()</code> * @requires <code>Date.isLeapYear()</code> * @return the number of days in the year for this date as either ! * '365' or '366' * @return <code>null</code> if an exception is encountered * @throws IllegalArgumentException *************** *** 514,518 **** } ! var sDaysInYear = (sIsLeapYear == '1') ? '366' : '365'; } catch (vError) { --- 516,520 ---- } ! var sDaysInYear = (parseInt(sIsLeapYear) == 1) ? '366' : '365'; } catch (vError) { *************** *** 530,541 **** /** ! * Calculates the day on which Easter Sunday falls for the current year using ! * Butcher's Method. Returns an integer between '1' and '31' * ! * @summary easter day * @author Stuart Wigley ! * @version 1.0, 12/01/03 * @interface <code>Date.getEasterDay()</code> ! * @return the day on which Easter Sunday falls * @return <code>null</code> if an exception is encountered * @throws IllegalArgumentException --- 532,549 ---- /** ! * Calculates and returns the day of the month on which Easter Sunday falls as ! * a one- or two-digit string between '1' and '31', inclusive, using Butcher's ! * Algorithm and the year contained in this date. NOTE: Butcher's Algorithm ! * holds true for any year in the Gregorian Calendar (i.e. a year greater than ! * or equal to 1583). * ! * @summary Easter day * @author Stuart Wigley ! * @author Randolph Fielding ! * @version 1.1, 10/27/03 * @interface <code>Date.getEasterDay()</code> ! * @return the day of the month on which Easter Sunday falls as a ! * one- or two-digit string between '1' and '31', ! * inclusive * @return <code>null</code> if an exception is encountered * @throws IllegalArgumentException *************** *** 549,553 **** if (iNumArguments > 0) { ! throw vError = new IllegalArgumentException('Date.getEasterDate', 0, iNumArguments); } --- 557,561 ---- if (iNumArguments > 0) { ! throw vError = new IllegalArgumentException('Date.getEasterDay', 0, iNumArguments); } *************** *** 560,571 **** var f = Math.floor((b + 8) / 25); var g = Math.floor((b - f + 1) / 3); ! var h = (19 * a + b - d - g + 15) % 30; var i = Math.floor(c / 4); var k = c % 4; ! var l = (32 + 2 * e + 2 * i - h - k) % 7; ! var m = Math.floor((a + 11 * h + 22 * l) / 451); ! var p = (h + l - 7 * m + 114) % 31; var iEasterDay = p + 1; ! } catch (vError) { --- 568,579 ---- var f = Math.floor((b + 8) / 25); var g = Math.floor((b - f + 1) / 3); ! var h = ((19 * a) + b - d - g + 15) % 30; var i = Math.floor(c / 4); var k = c % 4; ! var l = (32 + (2 * e) + (2 * i) - h - k) % 7; ! var m = Math.floor((a + (11 * h) + (22 * l)) / 451); ! var p = (h + l - (7 * m) + 114) % 31; var iEasterDay = p + 1; ! var sEasterDay = iEasterDay.toString(); } catch (vError) { *************** *** 577,581 **** finally { ! return vError ? null : iEasterDay; } } --- 585,589 ---- finally { ! return vError ? null : sEasterDay; } } *************** *** 583,594 **** /** ! * Calculates the month in which Easter Sunday falls for the current year using ! * Butcher's Method. Returns '3' for March or '4' for April. * ! * @summary easter month * @author Stuart Wigley ! * @version 1.0, 12/01/03 * @interface <code>Date.getEasterMonth()</code> ! * @return the month in which Easter Sunday falls * @return <code>null</code> if an exception is encountered * @throws IllegalArgumentException --- 591,608 ---- /** ! * Calculates and returns the month of the year in which Easter Sunday falls as ! * a one-digit string (i.e. '3' for March or '4' for April) using Butcher's ! * Algorithm and the year contained in this date. NOTE: Butcher's Algorithm ! * holds true for any year in the Gregorian Calendar (i.e. a year greater than ! * or equal to 1583). * ! * @summary Easter month * @author Stuart Wigley ! * @author Randolph Fielding ! * @version 1.1, 10/27/03 * @interface <code>Date.getEasterMonth()</code> ! * @return the month of the year in which Easter Sunday falls as ! * a one-digit string (i.e. '3' for March or '4' for ! * April) * @return <code>null</code> if an exception is encountered * @throws IllegalArgumentException *************** *** 613,623 **** var f = Math.floor((b + 8) / 25); var g = Math.floor((b - f + 1) / 3); ! var h = (19 * a + b - d - g + 15) % 30; var i = Math.floor(c / 4); var k = c % 4; ! var l = (32 + 2 * e + 2 * i - h - k) % 7; ! var m = Math.floor((a + 11 * h + 22 * l) / 451); ! var iEasterMonth = Math.floor((h + l - 7 * m + 114) / 31); ! } catch (vError) { --- 627,637 ---- var f = Math.floor((b + 8) / 25); var g = Math.floor((b - f + 1) / 3); ! var h = ((19 * a) + b - d - g + 15) % 30; var i = Math.floor(c / 4); var k = c % 4; ! var l = (32 + (2 * e) + (2 * i) - h - k) % 7; ! var m = Math.floor((a + (11 * h) + (22 * l)) / 451); ! var iEasterMonth = Math.floor((h + l - (7 * m) + 114) / 31); ! var sEasterMonth = iEasterMonth.toString(); } catch (vError) { *************** *** 629,633 **** finally { ! return vError ? null : iEasterMonth; } } --- 643,647 ---- finally { ! return vError ? null : sEasterMonth; } } *************** *** 1711,1721 **** /** ! * Returns Zodiac sign for the current date. * ! * @summary zodiac sign * @author Stuart Wigley ! * @version 1.0, 10/01/03 * @interface <code>Date.getZodiacSign()</code> ! * @return the Zodiac sign for the current date * @return <code>null</code> if an exception is encountered * @throws IllegalArgumentException --- 1725,1736 ---- /** ! * Returns the Zodiac sign for this date. * ! * @summary Zodiac sign * @author Stuart Wigley ! * @author Randolph Fielding ! * @version 1.1, 10/27/03 * @interface <code>Date.getZodiacSign()</code> ! * @return the Zodiac sign for this date * @return <code>null</code> if an exception is encountered * @throws IllegalArgumentException *************** *** 1729,1733 **** if (iNumArguments > 0) { ! throw vError = new IllegalArgumentException('Date.getZodiac', 0, iNumArguments); } --- 1744,1748 ---- if (iNumArguments > 0) { ! throw vError = new IllegalArgumentException('Date.getZodiacSign', 0, iNumArguments); } *************** *** 1736,1763 **** var sZodiacSign = ''; ! if (iMonth == 1 && iDay >= 20 || iMonth == 2 && iDay <=18) { ! sZodiacSign = "Aquarius"; ! } else if (iMonth == 2 && iDay >=19 || iMonth == 3 && iDay <=20) { ! sZodiacSign = "Pisces"; ! } else if (iMonth == 3 && iDay >=21 || iMonth == 4 && iDay <=19) { ! sZodiacSign = "Aries"; ! } else if (iMonth == 4 && iDay >=20 || iMonth == 5 && iDay <=20) { ! sZodiacSign = "Taurus"; ! } else if (iMonth == 5 && iDay >=21 || iMonth == 6 && iDay <=21) { ! sZodiacSign = "Gemini"; ! } else if (iMonth == 6 && iDay >=22 || iMonth == 7 && iDay <=22) { ! sZodiacSign = "Cancer"; ! } else if (iMonth == 7 && iDay >=23 || iMonth == 8 && iDay <=22) { ! sZodiacSign = "Leo"; ! } else if (iMonth == 8 && iDay >=23 || iMonth == 9 && iDay <=22) { ! sZodiacSign = "Virgo"; ! } else if (iMonth == 9 && iDay >=23 || iMonth == 10 && iDay <=22) { ! sZodiacSign = "Libra"; ! } else if (iMonth == 10 && iDay >=23 || iMonth == 11 && iDay <=21) { ! sZodiacSign = "Scorpio"; ! } else if (iMonth == 11 && iDay >=22 || iMonth == 12 && iDay <=21) { ! sZodiacSign = "Sagittarius"; ! } else if (iMonth == 12 && iDay >=22 || iMonth == 1 && iDay <=19) { ! sZodiacSign = "Capricorn"; } } --- 1751,1778 ---- var sZodiacSign = ''; ! if (((iMonth == 1) && (iDay >= 20)) || ((iMonth == 2) && (iDay <= 18))) { ! sZodiacSign = 'Aquarius'; ! } else if (((iMonth == 2) && (iDay >= 19)) || ((iMonth == 3) && (iDay <= 20))) { ! sZodiacSign = 'Pisces'; ! } else if (((iMonth == 3) && (iDay >= 21)) || ((iMonth == 4) && (iDay <= 19))) { ! sZodiacSign = 'Aries'; ! } else if (((iMonth == 4) && (iDay >= 20)) || ((iMonth == 5) && (iDay <= 20))) { ! sZodiacSign = 'Taurus'; ! } else if (((iMonth == 5) && (iDay >= 21)) || ((iMonth == 6) && (iDay <= 20))) { ! sZodiacSign = 'Gemini'; ! } else if (((iMonth == 6) && (iDay >= 21)) || ((iMonth == 7) && (iDay <= 22))) { ! sZodiacSign = 'Cancer'; ! } else if (((iMonth == 7) && (iDay >= 23)) || ((iMonth == 8) && (iDay <= 22))) { ! sZodiacSign = 'Leo'; ! } else if (((iMonth == 8) && (iDay >= 23)) || ((iMonth == 9) && (iDay <= 22))) { ! sZodiacSign = 'Virgo'; ! } else if (((iMonth == 9) && (iDay >= 23)) || ((iMonth == 10) && (iDay <= 22))) { ! sZodiacSign = 'Libra'; ! } else if (((iMonth == 10) && (iDay >= 23)) || ((iMonth == 11) && (iDay <= 21))) { ! sZodiacSign = 'Scorpio'; ! } else if (((iMonth == 11) && (iDay >= 22)) || ((iMonth == 12) && (iDay <= 21))) { ! sZodiacSign = 'Sagittarius'; ! } else if (((iMonth == 12) && (iDay >= 22)) || ((iMonth == 1) && (iDay <= 19))) { ! sZodiacSign = 'Capricorn'; } } *************** *** 1835,1846 **** /** ! * Determines if the current day is a weekday in the range Monday to Friday. * * @summary is weekday? * @author Stuart Wigley ! * @version 1.0, 10/01/03 * @interface <code>Date.isWeekday()</code> ! * @return '1' if the day is a weekday ! * @return '0' if the day is not a weekday * @return <code>null</code> if an exception is encountered * @throws IllegalArgumentException --- 1850,1864 ---- /** ! * Determines if the day of the week for this date is a weekday (i.e. Monday, ! * Tuesday, Wednesday, Thursday, or Friday). * * @summary is weekday? * @author Stuart Wigley ! * @author Randolph Fielding ! * @version 1.1, 10/27/03 * @interface <code>Date.isWeekday()</code> ! * @return '1' if the day of the week for this date is a weekday ! * @return '0' if the day of the week for this date is not a ! * weekday * @return <code>null</code> if an exception is encountered * @throws IllegalArgumentException *************** *** 1858,1862 **** var iDayOfWeek = this.getDay(); ! var sIsWeekDay = (iDayOfWeek > 0 && iDayOfWeek < 6) ? '1' : '0'; } catch (vError) { --- 1876,1880 ---- var iDayOfWeek = this.getDay(); ! var sIsWeekday = ((iDayOfWeek >= 1) && (iDayOfWeek <= 5)) ? '1' : '0'; } catch (vError) { *************** *** 1868,1872 **** finally { ! return vError ? null : sIsWeekDay; } } --- 1886,1890 ---- finally { ! return vError ? null : sIsWeekday; } } *************** *** 1874,1885 **** /** ! * Determines if the current day is a weekend ie Saturday or Sunday * * @summary is weekend? * @author Stuart Wigley ! * @version 1.0, 10/01/03 * @interface <code>Date.isWeekend()</code> ! * @return '1' if the day is a weekend ! * @return '0' if the day is not a weekend * @return <code>null</code> if an exception is encountered * @throws IllegalArgumentException --- 1892,1907 ---- /** ! * Determines if the day of the week for this date is a weekend day (i.e. ! * Saturday or Sunday). * * @summary is weekend? * @author Stuart Wigley ! * @author Randolph Fielding ! * @version 1.1, 10/27/03 * @interface <code>Date.isWeekend()</code> ! * @return '1' if the day of the week for this date is a weekend ! * day ! * @return '0' if the day of the week for this date is not a ! * weekend day * @return <code>null</code> if an exception is encountered * @throws IllegalArgumentException *************** *** 1897,1901 **** var iDayOfWeek = this.getDay(); ! var sIsWeekEnd = (iDayOfWeek == 0 || iDayOfWeek == 6) ? '1' : '0'; } catch (vError) { --- 1919,1923 ---- var iDayOfWeek = this.getDay(); ! var sIsWeekend = ((iDayOfWeek == 0) || (iDayOfWeek == 6)) ? '1' : '0'; } catch (vError) { *************** *** 1907,1911 **** finally { ! return vError ? null : sIsWeekEnd; } } --- 1929,1933 ---- finally { ! return vError ? null : sIsWeekend; } } |