问题
How do you write a FREQ
rule in iCalendar
data format for store's opening hours ?
Let's say the store is open every working day (Mon-Fri):
- from 8:00AM to 5:00PM
- (or with lunch break from) 8:00AM to 11:00AM and 12:00PM to 5:00PM
This would solve the days: FREQ=WEEKLY;WKST=MO;BYDAY=MO,TU,WE,TH,FR
, how about the hours though ?
Edit: Could I do sth like this?
DTSTART;TZID=America/New_York:19970902T080000
RRULE:FREQ=WEEKLY;WKST=MO;BYDAY=MO,TU,WE,TH,FR
DURATION=PT9H
Would this mean every day from Monday to Friday, from 8:00AM till 5:00PM (thanks to duration)?
回答1:
I think I solved it with DTSTART
and DTEND
like this:
BEGIN:VEVENT
...
DTSTAMP:20191016T133700Z
DTSTART;TZID=Europe/Bratislava:20191007T080000
DTEND;TZID=Europe/Bratislava:20191007T170000
RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR
SUMMARY:Opening hours without lunch break
...
END:VEVENT
And I think if I wanted to have opening hours with a lunch break, I'd have to create two separate events.
I believe using DURATION
(as mentioned in Question) would also be an option:
BEGIN:VEVENT
...
DTSTAMP:20191016T133700Z
DTSTART;TZID=Europe/Bratislava:20191007T080000
DURATION:PT9H
RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR
SUMMARY:Opening hours without lunch break
...
END:VEVENT
Edit:
This however marks an event in calendar, I'd like this time to be marked as free
time probably. Maybe sth with FREEBUSY
?
Would setting TRANSP:TRANSPARENT
mark this event as free time?
来源:https://stackoverflow.com/questions/58413821/icalendar-opening-hours