What you will do
You will run the prepared expression in the playground above, change one input at a time, and explain the result. Start in CEL only, then repeat the same rule in CEL + JSON.
How it works
Timestamp accessor methods expose calendar components. getFullYear() returns the year, while getMonth() uses zero-based months: January is 0 and July is 6. Without a time-zone argument, these accessors use UTC in CEL.
Read the prepared example
The CEL + JSON rule is:
timestamp(eventAt).getFullYear() == 2026 && timestamp(eventAt).getMonth() == 6Its input is:
{
"eventAt": "2026-07-23T09:15:00Z"
}The CEL only tab contains the values and the rule in one expression. The enabled cel.bind() extension keeps each name local to its final argument.
Evaluation step by step
- The input is parsed as a UTC timestamp.
getFullYear()returns2026.getMonth()returns6, so both comparisons are true.
Your task
- Run the example.
- Change the expected month from 6 to 7 and observe false.
- Change the date to
2026-08-01T00:00:00Zand run again.
Expected observation: July compares with 6; August compares with 7.
Common mistake
Human month numbers usually start at 1, but getMonth() starts at 0. Document that boundary wherever people enter month numbers.
Show the explanation
0.
Knowledge check
What does getMonth() return for January?
Key takeaway
Calendar accessors have precise conventions: UTC by default and zero-based month numbers.
Sources
CEL-DEV— official CEL overview.CEL-LANG— official CEL language definition.CEL-GO-BIND— official documentation for the optionalcel.bind()extension used by the self-contained tab.