weekdayRange.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * Module exports.
  3. */
  4. module.exports = weekdayRange;
  5. /**
  6. * Only the first parameter is mandatory. Either the second, the third, or both
  7. * may be left out.
  8. *
  9. * If only one parameter is present, the function yeilds a true value on the
  10. * weekday that the parameter represents. If the string "GMT" is specified as
  11. * a second parameter, times are taken to be in GMT, otherwise in local timezone.
  12. *
  13. * If both wd1 and wd1 are defined, the condition is true if the current weekday
  14. * is in between those two weekdays. Bounds are inclusive. If the "GMT" parameter
  15. * is specified, times are taken to be in GMT, otherwise the local timezone is
  16. * used.
  17. *
  18. * Valid "weekday strings" are:
  19. *
  20. * SUN MON TUE WED THU FRI SAT
  21. *
  22. * Examples:
  23. *
  24. * ``` js
  25. * weekdayRange("MON", "FRI")
  26. * true Monday trhough Friday (local timezone).
  27. *
  28. * weekdayRange("MON", "FRI", "GMT")
  29. * same as above, but GMT timezone.
  30. *
  31. * weekdayRange("SAT")
  32. * true on Saturdays local time.
  33. *
  34. * weekdayRange("SAT", "GMT")
  35. * true on Saturdays GMT time.
  36. *
  37. * weekdayRange("FRI", "MON")
  38. * true Friday through Monday (note, order does matter!).
  39. * ```
  40. *
  41. *
  42. * @param {String} wd1 one of the weekday strings.
  43. * @param {String} wd2 one of the weekday strings.
  44. * @param {String} gmt is either the string: GMT or is left out.
  45. * @return {Boolean}
  46. */
  47. function weekdayRange (wd1, wd2, gmt) {
  48. // TODO: implement me!
  49. return false;
  50. }