--- title: Moon rules description: The full MOON() syntax for scheduling by lunar phase, illumination percentage or a range. order: 3 --- # Moon rules `MOON(...)` is a rule expression you can use in a Calendite recurrence rule to schedule an event by lunar phase. See the [rule reference](/docs/rules-reference.html) for the surrounding syntax. Format: ```text MOON({phaseOrNumberOrRange}) MOON({phaseOrNumberOrRange}, {half}) ``` ## Supported phase values ```text NEW WAXING_CRESCENT FIRST_QUARTER WAXING_GIBBOUS FULL WANING_GIBBOUS LAST_QUARTER WANING_CRESCENT ``` Named phases represent the exact date of that moon phase. Examples: ```text MOON(FULL) MOON(NEW) MOON(FIRST_QUARTER) MOON(LAST_QUARTER) ``` ## Number values A number represents moon illumination as a percentage. ```text MOON(0) MOON(50) MOON(100) ``` Examples: ```text MOON(0) = new moon MOON(100) = full moon MOON(50) = 50% illumination, waxing or waning ``` For numbers between `1` and `99`, the rule may match twice in a lunar cycle: once while the moon is waxing and once while it is waning. ## Range values A range represents an illumination range. ```text MOON({start}..{end}) ``` Examples: ```text MOON(95..100) MOON(25..50) MOON(0..10) ``` Meaning: ```text MOON(95..100) ``` matches dates where the moon illumination is between `95%` and `100%`. ## Half values The optional second argument controls which half of the lunar cycle should be matched. Supported values: ```text WAXING WANING BOTH FIRST_HALF SECOND_HALF ``` Aliases: ```text WAXING = FIRST_HALF WANING = SECOND_HALF BOTH = default ``` Examples: ```text MOON(50, WAXING) MOON(50, WANING) MOON(50, BOTH) MOON(95..100, WAXING) MOON(95..100, WANING) MOON(95..100, BOTH) ``` Meaning: ```text MOON(50, WAXING) ``` matches the 50% illuminated moon during the first half of the lunar cycle. ```text MOON(50, WANING) ``` matches the 50% illuminated moon during the second half of the lunar cycle. ```text MOON(95..100, WAXING) ``` matches dates where the moon is between `95%` and `100%` illuminated while waxing. ```text MOON(95..100, WANING) ``` matches dates where the moon is between `95%` and `100%` illuminated while waning. ## Behaviour with named phases and half values When using a named phase, the half value is allowed but not needed. These are equivalent: ```text MOON(FULL) MOON(FULL, BOTH) MOON(FULL, WAXING) MOON(FULL, WANING) ``` They all mean: ```text the exact full moon date ``` The half argument only affects number and range rules. ## Examples ```text MOON(FULL) ``` The exact full moon date. ```text MOON(100) ``` The exact full moon date. ```text MOON(95..100) ``` Any date where the moon is between `95%` and `100%` illuminated, either waxing or waning. ```text MOON(95..100, WAXING) ``` Any date where the moon is between `95%` and `100%` illuminated during the waxing half of the lunar cycle. ```text MOON(95..100, WANING) ``` Any date where the moon is between `95%` and `100%` illuminated during the waning half of the lunar cycle. ```text MOON(50) ``` Any date where the moon is `50%` illuminated, either waxing or waning. ```text MOON(50, WAXING) ``` The waxing 50% moon. ```text MOON(50, WANING) ``` The waning 50% moon.