ISO 8601 重复间隔
R5/2008-03-01T13:00:00Z/P1Y2M10DT2H30M
这就是这个意思:
R5
表示间隔斜线重复 5 次后。2008-03-01T13:00:00Z
表示间隔从此给定日期时间开始。P1Y2M10DT2H30M
表示间隔持续时间- 1 年
- 2个月
- 10 天
- 2小时
- 30 分钟
我的问题是我不知道这里到底重复了什么。是否重复 间隔结束后立即发生吗?我可以指定每周一 13:00 到 14:00 发生活动吗?
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:
R5
means that the interval after the slash is repeated 5 times.2008-03-01T13:00:00Z
means that the interval begins at this given datetime.P1Y2M10DT2H30M
means that the interval lasts for- 1 year
- 2 months
- 10 days
- 2 hours
- 30 minutes
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
标准本身并没有明确说明,但这里唯一明显的解释是间隔连续重复。所以这个重复间隔:
将相当于这些非重复间隔:(
注:我的阅读是重复次数确实包括第一次出现)
没有办法表示“每周一从 13:00 到 14:00” ISO 8601 内部,但对于 iCalendar 格式的 VEVENT 来说这是很自然的。 (如果您可以完全在 ISO 8601 范围内做到这一点,那么这将引起一系列进一步的功能请求)
The standard itself doesn't clarify, but the only obvious interpretation here is that the interval repeats back-to-back. So this recurring interval:
Will be equivalent to these non-recurring intervals:
(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)
是的,ISO8601 确实定义了规则重复间隔(或者像“月”一样规则可以作为单位之一)。
应该生成这些时间:
它不像 RFC5545 (iCalendar) 那样定义“开始时间”和“结束时间”,甚至不像 RRULE 或 crontab 那样定义不规则重复。
您应该能够使用 ISO 周日期作为起点指定每周重复,但您需要为“开始”和“结束”时间单独重复:
第一个间隔用于开始时间:星期一 13:00 (从 2021 年开始),第二个是结束时间:每周一 14:00(从 2021 年开始)。
Yes, ISO8601 does define a regular repeating interval (or as regular as a "month" can be as one of the units).
Should generate these times:
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:
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).
我可能是个白痴(Long Covid Brain),但 ISO-8601 的明显扩展不是第二个持续时间部分吗?在没有第二持续时间的情况下,重复是背靠背的,在存在第二持续时间的情况下,实际重复的是每个周期开始时的较小持续时间事件。例如,
R/2021-W01-1T13:00:00Z/P1W/P1H
编辑:也许你甚至可以嵌套它们...
R/2021-W01-1T09: 00:00Z/P1W/R5/P1D/P8H
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
EDIT: Maybe you could even nest them ...
R/2021-W01-1T09:00:00Z/P1W/R5/P1D/P8H