kzh
kzh

Reputation: 20598

ISO 8601 Repeating Interval

Wikipedia gives an example of an ISO 8601 example of a repeating interval:

R5/2008-03-01T13:00:00Z/P1Y2M10DT2H30M

This is what this means:

My problem is that I do not know exactly what is being repeated here. Does the repetition occur immediately after the interval ends? Can I specify that every Monday something happens from 13:00 to 14:00?

Upvotes: 18

Views: 15437

Answers (3)

John H Woods
John H Woods

Reputation: 11

I'm probably being an idiot (Long Covid Brain) but isn't the obvious extension to ISO-8601 a second duration part? In the absence of the second duration, the repeats are back to back, in its presence what is actually repeating is a smaller duration event at the start of each period. e.g.

R/2021-W01-1T13:00:00Z/P1W/P1H

  • indefinite weekly repeat of hour long slots every Monday 1pm starting week 1 2021.

EDIT: Maybe you could even nest them ...

R/2021-W01-1T09:00:00Z/P1W/R5/P1D/P8H

  • Mon to Fri, 9am to 5pm, every week? Ok I'll get my coat

Upvotes: 1

brianary
brianary

Reputation: 9322

Yes, ISO8601 does define a regular repeating interval (or as regular as a "month" can be as one of the units).

R5/2008-03-01T13:00:00Z/P1Y2M10DT2H30M

Should generate these times:

2009-05-11T15:30:00Z
2010-07-21T18:00:00Z
2011-10-01T20:30:00Z
2012-12-11T23:00:00Z
2014-02-22T00:30:00Z

It doesn't define a "start time" and "end time" like RFC5545 (iCalendar) does, or even irregular repetition like RRULE or crontab can.

You should be able to specify a weekly repetition using the ISO Week Date as a starting point, but you'll need separate repetitions for "start" and "end" times:

R/2021-W01-1T13:00:00Z/P1W
R/2021-W01-1T14:00:00Z/P1W

The first interval is for the start times: Mondays at 13:00 (starting in 2021), and the second is for the end times: Mondays at 14:00 (starting in 2021).

Upvotes: 2

Mu Mind
Mu Mind

Reputation: 11194

The standard itself doesn't clarify, but the only obvious interpretation here is that the interval repeats back-to-back. So this recurring interval:

R2/2008-03-01T13:00:00Z/P1Y2M10DT2H30M

Will be equivalent to these non-recurring intervals:

2008-03-01T13:00:00Z/P1Y2M10DT2H30M
2009-05-01T15:30:00Z/P1Y2M10DT2H30M

(Note: my reading is that the number of repetitions does include the first occurrence)

There is no way to represent "every Monday from 13:00 to 14:00" inside of ISO 8601, but it's natural to do for a VEVENT in the iCalendar format. (If you could do that entirely within ISO 8601, then that would give rise to a slew of further feature requests)

Upvotes: 10

Related Questions