Package net.pricefx.common.util
package net.pricefx.common.util
Date and time-period helpers behind the Analytics calendar.
CalendarUtil works with time periods such as a year, a quarter or a month. It turns
a period name such as 2026-Q1 into a time period, lists the periods between two dates,
and parses dates. A time period can then filter a Datamart query on a date field.
Entry point: DatamartContext.calendar(), on the context
from api.getDatamartContext(). Its time periods and units are the nested
CalendarUtil.TimePeriod and CalendarUtil.TimeUnit types.
def calendar = api.getDatamartContext().calendar()
def quarter = calendar.getTimePeriod("2026-Q1")
def filter = calendar.timePeriodAsFilter(quarter, "InvoiceDate")
Reference
CalendarUtilworks with dates and time periods. ACalendarUtil.TimePeriodis a range of periods in oneCalendarUtil.TimeUnit, such as2026-Q1.