You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dateRange.js 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /**
  2. * Module exports.
  3. */
  4. module.exports = dateRange;
  5. /**
  6. * If only a single value is specified (from each category: day, month, year), the
  7. * function returns a true value only on days that match that specification. If
  8. * both values are specified, the result is true between those times, including
  9. * bounds.
  10. *
  11. * Even though the examples don't show, the "GMT" parameter can be specified
  12. * in any of the 9 different call profiles, always as the last parameter.
  13. *
  14. * Examples:
  15. *
  16. * ``` js
  17. * dateRange(1)
  18. * true on the first day of each month, local timezone.
  19. *
  20. * dateRange(1, "GMT")
  21. * true on the first day of each month, GMT timezone.
  22. *
  23. * dateRange(1, 15)
  24. * true on the first half of each month.
  25. *
  26. * dateRange(24, "DEC")
  27. * true on 24th of December each year.
  28. *
  29. * dateRange(24, "DEC", 1995)
  30. * true on 24th of December, 1995.
  31. *
  32. * dateRange("JAN", "MAR")
  33. * true on the first quarter of the year.
  34. *
  35. * dateRange(1, "JUN", 15, "AUG")
  36. * true from June 1st until August 15th, each year (including June 1st and August
  37. * 15th).
  38. *
  39. * dateRange(1, "JUN", 15, 1995, "AUG", 1995)
  40. * true from June 1st, 1995, until August 15th, same year.
  41. *
  42. * dateRange("OCT", 1995, "MAR", 1996)
  43. * true from October 1995 until March 1996 (including the entire month of October
  44. * 1995 and March 1996).
  45. *
  46. * dateRange(1995)
  47. * true during the entire year 1995.
  48. *
  49. * dateRange(1995, 1997)
  50. * true from beginning of year 1995 until the end of year 1997.
  51. * ```
  52. *
  53. * dateRange(day)
  54. * dateRange(day1, day2)
  55. * dateRange(mon)
  56. * dateRange(month1, month2)
  57. * dateRange(year)
  58. * dateRange(year1, year2)
  59. * dateRange(day1, month1, day2, month2)
  60. * dateRange(month1, year1, month2, year2)
  61. * dateRange(day1, month1, year1, day2, month2, year2)
  62. * dateRange(day1, month1, year1, day2, month2, year2, gmt)
  63. *
  64. * @param {String} day is the day of month between 1 and 31 (as an integer).
  65. * @param {String} month is one of the month strings: JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
  66. * @param {String} year is the full year number, for example 1995 (but not 95). Integer.
  67. * @param {String} gmt is either the string "GMT", which makes time comparison occur in GMT timezone; if left unspecified, times are taken to be in the local timezone.
  68. * @return {Boolean}
  69. */
  70. function dateRange () {
  71. // TODO: implement me!
  72. return false;
  73. }