[Jspro-cvs] jsPro README,1.24,1.25 date.js,1.7,1.8 CHANGES,1.19,1.20
Brought to you by:
wigleys
|
From: <wi...@us...> - 2003-10-01 10:02:20
|
Update of /cvsroot/jspro/jsPro
In directory sc8-pr-cvs1:/tmp/cvs-serv1036
Modified Files:
README date.js CHANGES
Log Message:
Added a couple of new Date functions that gets the number of methods up to 150 and makes a good excuse to do a release
Index: README
===================================================================
RCS file: /cvsroot/jspro/jsPro/README,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** README 24 Sep 2003 13:10:23 -0000 1.24
--- README 1 Oct 2003 10:02:13 -0000 1.25
***************
*** 10,14 ****
Array, Math, Date) and implements new classes such as Chemica, Debug and Point.
! In addition jsPro is developed to very high standard that includes modified
Hungarian Notation, structured error handling and JavaDoc style commenting.
This ensures that all methods in jsPro are readable, logical and easy to debug.
--- 10,14 ----
Array, Math, Date) and implements new classes such as Chemica, Debug and Point.
! In addition jsPro is developed to a high coding standard that includes modified
Hungarian Notation, structured error handling and JavaDoc style commenting.
This ensures that all methods in jsPro are readable, logical and easy to debug.
***************
*** 63,91 ****
24. Date.prototype.getDayOfYear(): day of year
25. Date.prototype.getDaysInMonth(): days in month
! 26. Date.prototype.getGMTOffset(): GMT offset
! 27. Date.prototype.getLong12Hours(): 12-hour two-digit hour (01-12)
! 28. Date.prototype.getLong24Hours(): 24-hour two-digit hour (00-23)
! 29. Date.prototype.getLongDate(): two-digit day of month (01-31)
! 30. Date.prototype.getLongDayName(): day name
! 31. Date.prototype.getLongMinutes(): two-digit minutes (00-59)
! 32. Date.prototype.getLongMonth(): two-digit month (01-12)
! 33. Date.prototype.getLongMonthName(): month name
! 34. Date.prototype.getLongSeconds(): two-digit seconds (00-59)
! 35. Date.prototype.getMeridiem(): meridiem
! 36. Date.prototype.getOrdinalSuffix(): English ordinal suffix
! 37. Date.prototype.getRFC822Date(): RFC 822 date
! 38. Date.prototype.getShort12Hours(): 12-hour one-/two-digit hour (1-12)
! 39. Date.prototype.getShort24Hours(): 24-hour one-/two-digit hour (0-23)
! 40. Date.prototype.getShortDayName(): short day name
! 41. Date.prototype.getShortMonth(): one-/two-digit month (1-12)
! 42. Date.prototype.getShortMonthName(): short month name
! 43. Date.prototype.getShortYear(): two-digit year (00-99)
! 44. Date.prototype.getSwatchTime(): Swatch Internet Time
! 45. Date.prototype.getTimeSeconds(): seconds since UNIX epoch
! 46. Date.prototype.getTimezone(): not implemented
! 47. Date.prototype.getTimezoneOffsetSeconds(): timezone offset in seconds
! 48. Date.prototype.getWeekOfYear(): week of year
! 49. Date.prototype.isDaylightSavingsTime(): not implemented
! 50. Date.prototype.isLeapYear(): is leap year?
elements.js
--- 63,97 ----
24. Date.prototype.getDayOfYear(): day of year
25. Date.prototype.getDaysInMonth(): days in month
! 26. Date.prototype.getDaysInYear(): days in year
! 27. Date.prototype.getEasterDay(): easter day
! 28. Date.prototype.getEasterMonth(): easter month
! 29. Date.prototype.getGMTOffset(): GMT offset
! 30. Date.prototype.getLong12Hours(): 12-hour two-digit hour (01-12)
! 31. Date.prototype.getLong24Hours(): 24-hour two-digit hour (00-23)
! 32. Date.prototype.getLongDate(): two-digit day of month (01-31)
! 33. Date.prototype.getLongDayName(): day name
! 34. Date.prototype.getLongMinutes(): two-digit minutes (00-59)
! 35. Date.prototype.getLongMonth(): two-digit month (01-12)
! 36. Date.prototype.getLongMonthName(): month name
! 37. Date.prototype.getLongSeconds(): two-digit seconds (00-59)
! 38. Date.prototype.getMeridiem(): meridiem
! 39. Date.prototype.getOrdinalSuffix(): English ordinal suffix
! 40. Date.prototype.getRFC822Date(): RFC 822 date
! 41. Date.prototype.getShort12Hours(): 12-hour one-/two-digit hour (1-12)
! 42. Date.prototype.getShort24Hours(): 24-hour one-/two-digit hour (0-23)
! 43. Date.prototype.getShortDayName(): short day name
! 44. Date.prototype.getShortMonth(): one-/two-digit month (1-12)
! 45. Date.prototype.getShortMonthName(): short month name
! 46. Date.prototype.getShortYear(): two-digit year (00-99)
! 47. Date.prototype.getSwatchTime(): Swatch Internet Time
! 48. Date.prototype.getTimeSeconds(): seconds since UNIX epoch
! 49. Date.prototype.getTimezone(): not implemented
! 50. Date.prototype.getTimezoneOffsetSeconds(): timezone offset in seconds
! 51. Date.prototype.getWeekOfYear(): week of year
! 52. Date.prototype.getZodiacSign(): zodiac sign
! 53. Date.prototype.isDaylightSavingsTime(): not implemented
! 54. Date.prototype.isLeapYear(): is leap year?
! 55. Date.prototype.isWeekday(): is weekday?
! 56. Date.prototype.isWeekend(): is weekend?
elements.js
***************
*** 94,206 ****
error.js
-------------------------------------------------------------------------------
! 51. Error.prototype.handleError(): handles thrown exceptions
math.js
-------------------------------------------------------------------------------
! 52. Math.acosh(): inverse hyperbolic cosine
! 53. Math.acot(): inverse cotangent
! 54. Math.acoth(): inverse hyperbolic cotangent
! 55. Math.acsc(): inverse cosecant
! 56. Math.acsch(): inverse hyperbolic cosecant
! 57. Math.approx(): approximately equal
! 58. Math.arg(): polar angle (argument)
! 59. Math.asec(): inverse secant
! 60. Math.asech(): inverse hyperbolic secant
! 61. Math.asinh(): inverse hyperbolic sine
! 62. Math.atanh(): inverse hyperbolic tangent
! 63. Math.baseConvert(): convert base
! 64. Math.bin2dec(): binary to decimal conversion
! 65. Math.bin2hex(): binary to hexadecimal conversion
! 66. Math.bin2oct(): binary to octal conversion
! 67. Math.cosh(): hyperbolic cosine
! 68. Math.cot(): cotangent
! 69. Math.coth(): hyperbolic cotangent
! 70. Math.cov(): coversine
! 71. Math.csc(): cosecant
! 72. Math.csch(): hyperbolic cosecant
! 73. Math.dec2bin(): decimal to binary conversion
! 74. Math.dec2hex(): decimal to hexadecimal conversion
! 75. Math.dec2oct(): decimal to octal conversion
! 76. Math.deg2grad(): degree to gradian conversion
! 77. Math.deg2rad(): degree to radian conversion
! 78. Math.exp10(): exponent of 10
! 79. Math.expm1(): exp(x) - 1
! 80. Math.exsec(): exsecant
! 81. Math.fibonacci(): Fibonacci sequence
! 82. Math.fmod(): floating-point remainder
! 83. Math.gd(): Gudermannian function
! 84. Math.grad2deg(): gradian to degree conversion
! 85. Math.grad2rad(): gradian to radian conversion
! 86. Math.hav(): haversine
! 87. Math.hex2bin(): hexadecimal to binary conversion
! 88. Math.hex2dec(): hexadecimal to decimal conversion
! 89. Math.hex2oct(): hexadecimal to octal conversion
! 90. Math.hypot(): hypotenuse
! 91. Math.isEven(): is even?
! 92. Math.isOdd(): is odd?
! 93. Math.isPrime(): is prime?
! 94. Math.log10(): base-10 logarithm
! 95. Math.log2(): base-2 logarithm
! 96. Math.log1p(): log(1 + x)
! 97. Math.luhn(): LUHN formula
! 98. Math.oct2bin(): octal to binary conversion
! 99. Math.oct2dec(): octal to decimal conversion
! 100. Math.oct2hex(): octal to hexadecimal conversion
! 101. Math.pi(): calculate pi
! 102. Math.rad2deg(): radian to degree conversion
! 103. Math.rad2grad(): radian to gradian conversion
! 104. Math.sec(): secant
! 105. Math.sech(): hyperbolic secant
! 106. Math.sigmoid(): sigmoid function
! 107. Math.sign(): sign
! 108. Math.sinc(): sinc function
! 109. Math.sinh(): hyperbolic sine
! 110. Math.sq(): square
! 111. Math.tanc(): tanc function
! 112. Math.tanh(): hyperbolic tangent
! 113. Math.vers(): versine
point.js
-------------------------------------------------------------------------------
! 114. Point.prototype.distance(): distance between two points
string.js
-------------------------------------------------------------------------------
! 115. String.prototype.addSlashes(): escape certain characters with backslashes
! 116. String.prototype.cat(): concatenate
! 117. String.prototype.compress(): compress whitespace to single spaces
! 118. String.prototype.count(): count occurrence of characters
! 119. String.prototype.htmlEntities(): encode XHTML 1.0 entities
! 120. String.prototype.htmlSpecialChars(): encode subset of HTML special characters
! 121. String.prototype.insert(): insert one string into another
! 122. String.prototype.isEmailAddress(): is email address?
! 123. String.prototype.levenshtein(): Levenshtein distance
! 124. String.prototype.lpad(): pad left side
! 125. String.prototype.ltrim(): trim left side
! 126. String.prototype.nl2br(): newline to <br> conversion
! 127. String.prototype.overlay(): overlay one string over another
! 128. String.prototype.pad(): pad
! 129. String.prototype.remove(): remove characters
! 130. String.prototype.repeat(): repeat
! 131. String.prototype.repeatChars(): repeat characters
! 132. String.prototype.reverse(): reverse
! 133. String.prototype.rot13(): rotate 13 encoding
! 134. String.prototype.rpad(): pad right side
! 135. String.prototype.rtrim(): trim right side
! 136. String.prototype.swap(): swap characters
! 137. String.prototype.trim(): trim
! 138. String.prototype.truncate(): truncate
! 139. String.prototype.ucFirst(): uppercase first character
! 140. String.prototype.ucWords(): uppercase words
! 141. String.prototype.wordWrap(): word wrap
validator.js
-------------------------------------------------------------------------------
! 142. Validator.prototype.isBlankString(): is blank string?
! 143. Validator.prototype.isDigit(): is single digit?
! 144. Validator.prototype.isInteger(): is integer?
! This file was generated automatically: Wed Sep 24 14:11:37 2003
--- 100,212 ----
error.js
-------------------------------------------------------------------------------
! 57. Error.prototype.handleError(): handles thrown exceptions
math.js
-------------------------------------------------------------------------------
! 58. Math.acosh(): inverse hyperbolic cosine
! 59. Math.acot(): inverse cotangent
! 60. Math.acoth(): inverse hyperbolic cotangent
! 61. Math.acsc(): inverse cosecant
! 62. Math.acsch(): inverse hyperbolic cosecant
! 63. Math.approx(): approximately equal
! 64. Math.arg(): polar angle (argument)
! 65. Math.asec(): inverse secant
! 66. Math.asech(): inverse hyperbolic secant
! 67. Math.asinh(): inverse hyperbolic sine
! 68. Math.atanh(): inverse hyperbolic tangent
! 69. Math.baseConvert(): convert base
! 70. Math.bin2dec(): binary to decimal conversion
! 71. Math.bin2hex(): binary to hexadecimal conversion
! 72. Math.bin2oct(): binary to octal conversion
! 73. Math.cosh(): hyperbolic cosine
! 74. Math.cot(): cotangent
! 75. Math.coth(): hyperbolic cotangent
! 76. Math.cov(): coversine
! 77. Math.csc(): cosecant
! 78. Math.csch(): hyperbolic cosecant
! 79. Math.dec2bin(): decimal to binary conversion
! 80. Math.dec2hex(): decimal to hexadecimal conversion
! 81. Math.dec2oct(): decimal to octal conversion
! 82. Math.deg2grad(): degree to gradian conversion
! 83. Math.deg2rad(): degree to radian conversion
! 84. Math.exp10(): exponent of 10
! 85. Math.expm1(): exp(x) - 1
! 86. Math.exsec(): exsecant
! 87. Math.fibonacci(): Fibonacci sequence
! 88. Math.fmod(): floating-point remainder
! 89. Math.gd(): Gudermannian function
! 90. Math.grad2deg(): gradian to degree conversion
! 91. Math.grad2rad(): gradian to radian conversion
! 92. Math.hav(): haversine
! 93. Math.hex2bin(): hexadecimal to binary conversion
! 94. Math.hex2dec(): hexadecimal to decimal conversion
! 95. Math.hex2oct(): hexadecimal to octal conversion
! 96. Math.hypot(): hypotenuse
! 97. Math.isEven(): is even?
! 98. Math.isOdd(): is odd?
! 99. Math.isPrime(): is prime?
! 100. Math.log10(): base-10 logarithm
! 101. Math.log2(): base-2 logarithm
! 102. Math.log1p(): log(1 + x)
! 103. Math.luhn(): LUHN formula
! 104. Math.oct2bin(): octal to binary conversion
! 105. Math.oct2dec(): octal to decimal conversion
! 106. Math.oct2hex(): octal to hexadecimal conversion
! 107. Math.pi(): calculate pi
! 108. Math.rad2deg(): radian to degree conversion
! 109. Math.rad2grad(): radian to gradian conversion
! 110. Math.sec(): secant
! 111. Math.sech(): hyperbolic secant
! 112. Math.sigmoid(): sigmoid function
! 113. Math.sign(): sign
! 114. Math.sinc(): sinc function
! 115. Math.sinh(): hyperbolic sine
! 116. Math.sq(): square
! 117. Math.tanc(): tanc function
! 118. Math.tanh(): hyperbolic tangent
! 119. Math.vers(): versine
point.js
-------------------------------------------------------------------------------
! 120. Point.prototype.distance(): distance between two points
string.js
-------------------------------------------------------------------------------
! 121. String.prototype.addSlashes(): escape certain characters with backslashes
! 122. String.prototype.cat(): concatenate
! 123. String.prototype.compress(): compress whitespace to single spaces
! 124. String.prototype.count(): count occurrence of characters
! 125. String.prototype.htmlEntities(): encode XHTML 1.0 entities
! 126. String.prototype.htmlSpecialChars(): encode subset of HTML special characters
! 127. String.prototype.insert(): insert one string into another
! 128. String.prototype.isEmailAddress(): is email address?
! 129. String.prototype.levenshtein(): Levenshtein distance
! 130. String.prototype.lpad(): pad left side
! 131. String.prototype.ltrim(): trim left side
! 132. String.prototype.nl2br(): newline to <br> conversion
! 133. String.prototype.overlay(): overlay one string over another
! 134. String.prototype.pad(): pad
! 135. String.prototype.remove(): remove characters
! 136. String.prototype.repeat(): repeat
! 137. String.prototype.repeatChars(): repeat characters
! 138. String.prototype.reverse(): reverse
! 139. String.prototype.rot13(): rotate 13 encoding
! 140. String.prototype.rpad(): pad right side
! 141. String.prototype.rtrim(): trim right side
! 142. String.prototype.swap(): swap characters
! 143. String.prototype.trim(): trim
! 144. String.prototype.truncate(): truncate
! 145. String.prototype.ucFirst(): uppercase first character
! 146. String.prototype.ucWords(): uppercase words
! 147. String.prototype.wordWrap(): word wrap
validator.js
-------------------------------------------------------------------------------
! 148. Validator.prototype.isBlankString(): is blank string?
! 149. Validator.prototype.isDigit(): is single digit?
! 150. Validator.prototype.isInteger(): is integer?
! This file was generated automatically: Wed Oct 1 11:03:32 2003
Index: date.js
===================================================================
RCS file: /cvsroot/jspro/jsPro/date.js,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** date.js 14 Sep 2003 09:37:52 -0000 1.7
--- date.js 1 Oct 2003 10:02:14 -0000 1.8
***************
*** 478,481 ****
--- 478,638 ----
/**
+ * 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
+ * @throws MethodNotAvailableException
+ * @throws UnknownException
+ * @see <code>Date.isLeapYear()</code>
+ */
+ Date.prototype.getDaysInYear = function() {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (!('isLeapYear' in this)) {
+ throw vError = new MethodNotAvailableException('Date.getDaysInYear', 'Date.isLeapYear');
+ }
+
+ if (iNumArguments > 0) {
+ throw vError = new IllegalArgumentException('Date.getDaysInYear', 0, iNumArguments);
+ }
+
+ var sIsLeapYear = this.isLeapYear();
+
+ if (!sIsLeapYear) {
+ throw vError = new UnknownException('Date.getDaysInYear');
+ }
+
+ var sDaysInYear = (sIsLeapYear == '1') ? '366' : '365';
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : sDaysInYear;
+ }
+ }
+
+
+ /**
+ * 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
+ */
+ Date.prototype.getEasterDay = function() {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments > 0) {
+ throw vError = new IllegalArgumentException('Date.getEasterDate', 0, iNumArguments);
+ }
+
+ var iYear = this.getFullYear();
+ var a = iYear % 19;
+ var b = Math.floor(iYear / 100);
+ var c = iYear % 100;
+ var d = Math.floor(b / 4);
+ var e = b % 4;
+ 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) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : iEasterDay;
+ }
+ }
+
+
+ /**
+ * 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
+ */
+ Date.prototype.getEasterMonth = function() {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments > 0) {
+ throw vError = new IllegalArgumentException('Date.getEasterMonth', 0, iNumArguments);
+ }
+
+ var iYear = this.getFullYear();
+ var a = iYear % 19;
+ var b = Math.floor(iYear / 100);
+ var c = iYear % 100;
+ var d = Math.floor(b / 4);
+ var e = b % 4;
+ 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) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : iEasterMonth;
+ }
+ }
+
+
+ /**
* Returns the formatted Greenwich Mean Time (GMT) offset ('[+/-]HHMM') for
* this date that consists of a plus sign (+) or minus sign (-) followed by
***************
*** 1554,1557 ****
--- 1711,1779 ----
/**
+ * 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
+ */
+ Date.prototype.getZodiacSign = function() {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments > 0) {
+ throw vError = new IllegalArgumentException('Date.getZodiac', 0, iNumArguments);
+ }
+
+ var iMonth = this.getMonth() + 1;
+ var iDay = this.getDate();
+ 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";
+ }
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : sZodiacSign;
+ }
+ }
+
+
+ /**
* Determines if this date falls within Daylight Savings Time.
*
***************
*** 1608,1611 ****
--- 1830,1911 ----
return vError ? null : sIsLeapYear;
+ }
+ }
+
+
+ /**
+ * 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
+ */
+ Date.prototype.isWeekday = function() {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments > 0) {
+ throw vError = new IllegalArgumentException('Date.isWeekday', 0, iNumArguments);
+ }
+
+ var iDayOfWeek = this.getDay();
+ var sIsWeekDay = (iDayOfWeek > 0 && iDayOfWeek < 6) ? '1' : '0';
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : sIsWeekDay;
+ }
+ }
+
+
+ /**
+ * 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
+ */
+ Date.prototype.isWeekend = function() {
+
+ try {
+
+ var vError = null;
+ var iNumArguments = arguments.length;
+
+ if (iNumArguments > 0) {
+ throw vError = new IllegalArgumentException('Date.isWeekend', 0, iNumArguments);
+ }
+
+ var iDayOfWeek = this.getDay();
+ var sIsWeekEnd = (iDayOfWeek == 0 || iDayOfWeek == 6) ? '1' : '0';
+ }
+ catch (vError) {
+
+ if (vError instanceof Error) {
+ vError.handleError();
+ }
+ }
+ finally {
+
+ return vError ? null : sIsWeekEnd;
}
}
Index: CHANGES
===================================================================
RCS file: /cvsroot/jspro/jsPro/CHANGES,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** CHANGES 24 Sep 2003 13:10:23 -0000 1.19
--- CHANGES 1 Oct 2003 10:02:14 -0000 1.20
***************
*** 1,4 ****
===============================================================================
! Whats new in R3? (Not Yet Released)
===============================================================================
--- 1,4 ----
===============================================================================
! Whats new in R3? (01 Oct 2003)
===============================================================================
***************
*** 25,28 ****
--- 25,37 ----
- Constants.PIFORMULA_HUTTON
- Constants.PIFORMULA_MACHIN
+
+ date.js:
+
+ - Date.getDaysInYear()
+ - Date.getEasterDay()
+ - Date.getEasterMonth()
+ - Date.getZodiacSign()
+ - Date.isWeekday()
+ - Date.isWeekend()
debug/debug.js:
|