Scheduling
A promotion only applies while it's active at the location where the sale is happening. Its schedule is in the ICalVEventSchedule field, as an iCalendar VEVENT.
iCalendar is an open standard for exchanging calendar information, and there are libraries for parsing it in many languages. It supports a wide range of scheduling options, but Cova Promotions use very few of them.
Reading a schedule
A typical ICalVEventSchedule value looks like this:
"ICalVEventSchedule": "BEGIN:VEVENT\r\nUID:a2875ac9-4b56-42c0-b2ac-28406b092f0a\r\nSEQUENCE:0\r\nDTSTAMP:20240916T185552Z\r\nDTSTART:20240916T180000\r\nDTEND:20240916T200000\r\nRRULE:FREQ=DAILY;UNTIL=20300916T200000\r\nSUMMARY:18a509c5-82fa-4b97-83ee-c20037d26e5b\r\nEND:VEVENT\r\n"
Once the \r\n line breaks are applied, that's:
BEGIN:VEVENT
UID:a2875ac9-4b56-42c0-b2ac-28406b092f0a
SEQUENCE:0
DTSTAMP:20240916T185552Z
DTSTART:20240916T180000
DTEND:20240916T200000
RRULE:FREQ=DAILY;UNTIL=20300916T200000
SUMMARY:18a509c5-82fa-4b97-83ee-c20037d26e5b
END:VEVENT
| Property | Meaning |
|---|---|
UID | A generated GUID that uniquely identifies this schedule. It isn't related to anything else. |
DTSTAMP | When this schedule was created. It has no relation to when the promotion is active. |
DTSTART | The date and time the promotion starts. |
DTEND | The date and time the promotion ends. With an RRULE, the end date is replaced by the date in the RRULE's UNTIL, and DTEND only gives the end time. |
RRULE | The promotion's recurrence rule. |
SUMMARY | The PromotionId of the promotion. Useful when importing many schedules into a calendar, to tell which promotion is active. |
In this example:
DTSTARTis 18:00:00 on 2024-09-16.DTENDis 20:00:00 on 2024-09-16.RRULErepeats daily until 2030-09-16.
So the promotion runs from 18:00:00 to 20:00:00 every day, from 2024-09-16 until 2030-09-16.
Another example
BEGIN:VEVENT
UID:d5c79244-d455-4b72-8127-385633df205c
SEQUENCE:0
DTSTAMP:20240909T175013Z
DTSTART:20240806T000000
DTEND:20240806T235959
RRULE:FREQ=WEEKLY;UNTIL=20310802T235959;BYDAY=TU,TH
SUMMARY:1b3c14eb-1f89-4c2c-b2f2-d2d9af8743f7
END:VEVENT
DTSTARTis 00:00:00 on 2024-08-06.DTENDis 23:59:59 on 2024-08-06.RRULErepeats weekly on Tuesdays and Thursdays until 23:59:59 on 2031-08-02.
So the promotion runs all day every Tuesday and Thursday, from 2024-08-06 until 2031-08-02.
Supported schedules
All Cova Promotions use VEVENT schedules shaped like the examples above. Their dates and times differ, but the general shape is the same.
iCalendar allows much more complex schedules, but anything beyond what's shown here isn't currently supported. For example, Cova Promotions don't use:
- Monthly or yearly recurrences in
RRULE. - Geographic location fields.
- Other date/time formats.