Calendar and Period Types
A calendar in Spectre represents a collection of period types. A calendar must include the year period type, and depending on the calendar, it might also specify other periods such as year-quarter, year-month, and year-week. The smaller periods are named after their elements. For instance, an example of a year-month period value might be February 2017, which has a year element and a month element.
Each period value in Spectre has a calendar and period type associated with it. For example, a period value representing the 15th week in ISO week year 2015 would have the calendar iso 8601 (referring to the ISO 8601 week-numbering system) and the period type year-week.
Spectre comes with some built-in calendars, but you can also add custom calendars. The built-in calendars are:
Built-in Calendar | Description |
---|---|
Standard |
This is the widely used Gregorian calendar, with 365 or 366 days, and 12 months per year. It supports the following period types: year, year-half, year-quarter, year-tertile, year-month |
ISO 8601 |
This is the ISO week-numbering system, with 364 or 371 days, and 52 or 53 weeks per year. It supports the following period types: year, year-week |
Offset <month-name> |
This is a fiscal year similar to the standard calendar except starting on a different month. The <month-name> must be a full English month name. For example, "offset October" is a calendar beginning on October 1 and ending on September 30. The fiscal year number corresponds to the standard year in which the fiscal year ends. For instance, year 2017 in "offset October" ends on September 30, 2017. Offset calendars support the following period types: year, year-half, year-quarter, year-tertile, year-month |
NOTE: Calendar names are not case sensitive.
In versions of Spectre prior to 7.0(35), calendars combine the current "calendar" and "period type" settings into a single "calendar-period" setting. Also, the calendar names have changed to be more user-friendly. Here is a table describing the previous calendar names and how they map to the new calendars and period types:
Old Calendar | New Calendar | New Period Type |
---|---|---|
gregorian month | standard | year-month |
gregorian quarter | standard | year-quarter |
gregorian+<number> month | offset <month> | year-month |
iso8601 week | iso 8601 | year-week |
<custom-calendar>.cbase | <varies> | <varies> |
NOTE: The previous calendar names are supported, but are deprecated.
The new offset <month> means "a calendar with the new year starting on the first of <month>". For example, offset February sets the first month of 2018 in that calendar to coincide with February 2017 in the Gregorian calendar.
The deprecated form gregorian+<number> month means "a calendar moved forward <number> months", that is, it starts that many months sooner than standard. For example, gregorian+1 sets the first month of 2018 in that calendar to coincide with December 2017.
To explicitly draw the equivalence between the previous and new calendars:
Deprecated Calendar Syntax | Current Calendar Syntax |
---|---|
gregorian+1 month | offset December |
gregorian+2 month | offset November |
gregorian+3 month | offset October |
gregorian+4 month | offset September |
gregorian+5 month | offset August |
gregorian+6 month | offset July |
gregorian+7 month | offset June |
gregorian+8 month | offset May |
gregorian+9 month | offset April |
gregorian+10 month | offset March |
gregorian+11 month | offset February |
See also: