Discourse Calendar

:discourse2: Summary Discourse Calendar gives the ability to create a dynamic calendar in the first post of a topic. New calendar items can be added by posting a reply with a date using the “Insert Date” modal.
:hammer_and_wrench: Repository Link https://github.com/discourse/discourse-calendar
:open_book: Install Guide How to install plugins in Discourse

Features

To embed the calendar, add the following BBCode (note the separate lines) in the first post of a topic:

[calendar]
[/calendar]

Optionally you can hide weekends and other days with special attributes. Hidden days are 0 to 6 for Sunday to Saturday respectively. As currently implemented, Monday is the first day of every week, regardless of the viewer’s locale settings and this is not currently configurable.

You can also set the default view to:

  • Month (month)
  • Week (basicWeek), which shows days in columns
  • List (listNextYear) which lists all entries in the next year.

In addition, you can ignore timezones by setting fullDay attribute.

For example:

[calendar weekends="false" hiddenDays="1,2" defaultView="listNextYear" fullDay="true"]
[/calendar]

To add events to the calendar, use the Insert Date function from the composer options menu to insert a single date or date range in any reply to the topic. For example,

[date-range from=2018-12-20 to=2018-12-21 timezone="America/Boise"]

Any text above this line will describe the calendar entry. For example:

It's my birthday!
[date-range from=2018-12-20 to=2018-12-21 timezone="America/Boise"]

You can also create repeating events by using the Recurrence feature in the date-entry widget. For example:

I could never get the hang of Thursdays.
[date=2021-12-16 time=09:00:00 timezone="America/New_York" recurring="1.weeks"]

The tool won’t let you create recurring events with a duration, and it seems to ignore the actual date when you do this. But you can have something happen every Thursday.

Note that the calendar itself always is in UTC, so events that are a 24-hour single day in your timezone may appear to span multiple days. The plugin settings all day event start time and all day event end time can be used to reduce the impact of this if your users happen to be in a timezone where that works out to be convenient. (It is unclear what timezone these settings use.)

Once the reply is submitted, the date range should be added to the calendar in the top post in the topic, and displayed after a reload of the topic.

Once the event is over the post containing the dates can be automatically deleted, based on the delete expired event posts after plugin configuration option. You can also use the topic timer to auto-delete replies.

Holiday Calendar

There is an optional, special “holiday calendar”, primarily intended to help manage site staff holidays.

This is controlled by the setting holiday calendar topic id. By setting holiday_calendar_topic_id to the ID of a topic which has a calendar in the top post, that calendar becomes special — instead of regular calendar entries, any replies will be taken as “vacation time” for that user. These entries will be automatically (and randomly) colored. (It is not possible to control the colors, nor to get colored entries in the normal type of calendar.)

Additionally, the emoji :desert_island: will appear next to the names of people on vacation in their user cards, and a calendar icon next to their name when @username mentioned in a post. This is visible to anyone (logged in or not).

The calendar will also by default include an entry for every user for every holiday in that user’s locale, if they’ve set one. This can be quite overwhelming. Adding

.calendar .grouped-event {
  display: none;
}

to a theme component and adding that to all themes will hide this as a temporary workaround.

Events

The plugin has an “Event” feature, but consider it in alpha state. This works entirely differently, and creates a site-wide calendar from entries across multiple topics, rather than per-topic calendars. For more information on this see 🗓 Discourse Event.

This should not be confused with the Events plugin (note plural), which is entirely different.

Screenshots

Dynamic Events Calendar

Holiday Calendar

Holiday Flair

holiday-flair

Holiday Mention Icon

mention

Translations:

https://translate.discourse.org/calendar

CHANGELOG

TODO

77 Likes
How to use the calendar plugin?
Events Plugin :calendar:
Calendar plugin, nothing is displayed
Discourse Calendar - How to?
Discourse 2.2.0.beta3 Release Notes
How to use the calendar plugin?
Discourse Calendar dislpay link text rather than link url
Ability to mark any post as unread
Is there a room booking plugin?
Idea: available hours / work hours flair
Moderator/Admin Off Duty Button
Vacation autoresponder for users who are away?
Go from a Wordpress + Discourse structure to a Discourse site only?
Db:migrate fails on discourse-calendar
📅 Event List Widget (Layouts Plugin)
Plugin to show upcoming events on hosted discourse
New to Discourse, have some questions :)
Sorting Categories by Title
Category Calendar with defaultView="listNextYear" not showing events
The "Save Changes" button is very low on my user preferences interface page
Feature request: wrap calendar items when there's just one per day
Custom Discourse instance for a writers club
Unread messages blue numbers appearing in Latest lately (when they shouldn't)?
Database migration chokes on huge value of a "calendar-details" item in table "post_custom_fields"
"Out of office" user indicator
Database migration chokes on huge value of a "calendar-details" item in table "post_custom_fields"
Events Plugin :calendar:
Calendar plugin features to make it really useful for us
"Out of office" user indicator
Category Calendar with defaultView="listNextYear" not showing events
Expired events with end times are being removed from upcoming-events even with setting set to -1
:arrows_counterclockwise: Setup Continuous Integration using GitHub Actions
Is there any way to change the starting date of the Calendar?

Second this. Interested in doing this as well.

I’m pretty sure that is by design, and keeps it clean by associating the text of a single reply with each calendar event.

You could automate the production of replies if you needed to do that on a grand scale. Or you might want to check out pavilion’s Events plugin once the new integration features come on line in the next few weeks to months. For a sneak preview you might like to look at Events Integration Plugin (Beta).

1 Like

Thanks. I know you are the messenger but this seems like a big and completely unnecessary limitation. Why would I want 100 posts for 100 entries? I can’t imagine doing this with 100 posts no matter how that’s done. My use-model is to create a complete year’s calendar in a single post (just so the calendar is visible). For my use there are no others posting and few changes. We don’t care about alarms or anything else. We just want a nice, visible calendar. Clearly, this plugin is not that. As it is I have to create a separate google calendar and post a link.

Thanks for clarifying the limitations. Sounds like a new project for some would-be coder.

That project is pretty much what I was referring to by this:

You’d be able to host the calendar anywhere (i.e. Google calendar), for ease of management. It will make a Topic (i.e. even more than a post) for each one automatically; that could be handy for comments / discussion though.

Another (simple) approach

Why not (using this plugin) make a (sub)category exclusively for your calendar topic which directs the user to the first post (is a category setting)?

This way, all those posts will be a scroll down and won’t get in the way.

You could even get all fancy and hide the posts from most of your users using CSS.

Muting the category for all users would keep it off the /Latest feeds, but you’d need to provide an alternative route to it of course.

Well, I appreciate you taking the time to respond and try to be as helpful as you can but I simply have zero needs for anything event related in discourse. And, I consider the entire idea of having many pages of posts that my users have to somehow know to ignore and not be confused by. I want something very simple: a calendar that shows up on a SINGLE post (I can live that withing that single posts all the day/times are nicely listed below the calendar). As it is I have to try to explain to evert user “do not read or be confused by all the junk below the calendar”. Oh, and why would I not want a nice single-post calendar with other things below it - like user’s posts asking questions, etc. Now they have to scroll and ignore all the calendar creation entries to see anything posted by someone else. The current “events” calendar was created with something else in mind than what I’m looking for. That said, with one simple change (i.e., the calendar scanning code reads ALL events in the calendar post itself (this is how I thought it worked at first and I spent hours trying to figure out why it accepted only on per post) instead of just one), it would satisfy my needs and still work for existing users. Whatever the scanning code is that reads the posts for the event lines could just keep reading instead of stopping at one.

Maybe a better way to say this is I do not want the actual data that created the calendar events to be visible at all - the calendar just shows up in ANY reply and the way it was created is a mystery other than to the creator (that is after all what a google calendar is). I can think of many ways to do this but since no one is going to implement it I’m going to save myself the time of writing it down. I’ll just stick with a google calendar and a link to it.

FWIW I think you can embed a google calendar in a post using the iframe code if you use the allowed iframes admin setting and set the permission of the calendar to be public.

2 Likes

Thanks. My complaint with using a google calendar is I have to maintain something outside of discourse and that calendar has to be created with a google user dedicated to my discourse project (i.e., I wouldn’t want to use a personal google account).

3 Likes

Scott, have you considered simply using a table? Like…

January 2023

Sunday Monday Tuesday Wednesday Thursday Friday Saturday
1
 
2
 
3
 
4
 
5
 
6
 
7
 
8
 
9
A thing!
10
 
11
 
12
 
13
 
14
 
15
 
16
 
17
 
18
More!
19
 
20
 
21
 
22
 
23
 
24
Another.
25
 
26
 
27
 
28
 
29
 
30
 
31
 

It seems like it wouldn’t be terribly hard to build on the discourse-table-builder theme component to create a static-calendar-table builder, if you get tired of creating them by hand.

2 Likes

I was wondering how one goes about creating an All Day event. I tried creating an event and omitting the date/time component, which looks as follows:

[event start="2023-03-20" status="public" name="My Event" end="2023-03-23" allowedGroups="trust_level_0"]

However, when I attempt to add this event to my calendar (i.e., iCal export), I get an iCal file that looks as follows:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Discourse//EN
BEGIN:VEVENT
UID:1679270400000_1679529600000
DTSTAMP:20230121T192236Z
DTSTART:20230320T000000Z
DTEND:20230323T000000Z
SUMMARY:My Event
END:VEVENT
END:VCALENDAR

Outlook does not recognize such an event as an all-day event. I can achieve that when I edit the iCal file myself as follows—changing the start and end timestamps to date-only values:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Discourse//EN
BEGIN:VEVENT
UID:1679270400000_1679529600000
DTSTAMP:20230121T192236Z
DTSTART;VALUE=DATE:20230320
DTEND;VALUE=DATE:20230323
SUMMARY:My Event
END:VEVENT
END:VCALENDAR

Is it possible to create an event that will automatically be treated by calendar software as an all-day event?

One more question in addition to the above :blush:

Is it possible to add the upcoming events calendar created by Discourse Calendar to the top menu? I’ve tried doing this through Settings → Basic Setup → Top Menu but the few options that I tried (e.g., upcoming-events, calendar, events, etc.) did not pan out.

You’ll need a theme component to do that. I’m not sure if there is an existing one.