Syntax
dateRange(<day> | <month> | <year>, [gmt]) // ambiguity is resolved by assuming year is greater than 31
dateRange(<day1>, <day2>, [gmt])
dateRange(<month1>, <month2>, [gmt])
dateRange(<year1>, <year2>, [gmt])
dateRange(<day1>, <month1>, <day2>, <month2>, [gmt])
dateRange(<month1>, <year1>, <month2>, <year2>, [gmt])
dateRange(<day1>, <month1>, <year1>, <day2>, <month2>, <year2>, [gmt])
Note: (Before Firefox 49) day1 must be less than day2, month1 must be less than month2, and year1 must be less than year2 if you want the function to evaluate these parameters as a range. See the warning below.
Parameters
- day
-
Is the ordered day of the month between 1 and 31 (as an integer).
1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31
- month
-
Is one of the ordered month strings below.
"JAN"|"FEB"|"MAR"|"APR"|"MAY"|"JUN"|"JUL"|"AUG"|"SEP"|"OCT"|"NOV"|"DEC"
- year
-
Is the ordered full year integer number. For example, 2016 (not 16).
- gmt
-
Is either the string "GMT", which makes time comparison occur in GMT timezone, or is left out. If left unspecified, times are taken to be in the local timezone.
If only a single value is specified (from each category: day, month, year), the function returns a true value only on days that match that specification. If both values are specified, the result is true between those times, including bounds, but the bounds are ordered.
Warning: The order of the days, months, and years matter; Before Firefox 49, dateRange("JAN", "DEC")
will always evaluate to true
. Now dateRange("DEC", "JAN")
will only evaluate true if the current month is December or January.
Examples
dateRange(1);
dateRange(1, "GMT")
dateRange(1, 15);
dateRange(24, "DEC");
dateRange("JAN", "MAR");
dateRange(1, "JUN", 15, "AUG");
dateRange(1, "JUN", 1995, 15, "AUG", 1995);
dateRange("OCT", 1995, "MAR", 1996);
dateRange(1995);
dateRange(1995, 1997);