> For the complete documentation index, see [llms.txt](https://docs.wem.io/platform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wem.io/platform/wemtipsandtricks/widgets/global-widgets/calendar.md).

# Calendar

## Calendar functionality <a href="#calendar-functionality" id="calendar-functionality"></a>

If you want to use calendar or date and time functionality within you applications you can use different calendar widgets depending on the desired functionality. WEM offers a calendar, agenda and timeline widget.

<div><figure><img src="/files/ENQYrm5lamAWCYz657Ep" alt=""><figcaption><p>Calendar</p></figcaption></figure> <figure><img src="/files/cK2i7S03HvMQJE21z0Pq" alt=""><figcaption><p>Timeline</p></figcaption></figure></div>

<figure><img src="/files/GBJ1JWxX2JXwqk3nwcuz" alt=""><figcaption><p>Agenda</p></figcaption></figure>

The Calendar widget can be used when you need a date selection picker as a start of your functionality. The Calendar widget displays a graphical view of a calendar and stores the selected date to use in your application. The Calendar widget also indicates if there are records stored on a date.

Minimal required properties:

* Selected Date, should be a valid date-field from Data model (not from a list) AND must be initialized as it determines the first month to display and day to highlight;
* List of events with at least one date field, to determine whether a day should be highlighted and active;
* The date-field in the Events list to match the day on calendar with.

<figure><img src="/files/z5l3VkNdSuzb2DpPV6aR" alt=""><figcaption></figcaption></figure>

## How to

We are going to explain the use of the Calendar widget by using an example. In this example we are going to create a simple **to do list** for a day. When a user clicks on a date in the calendar widget, a to do list appears.

Before you start you will have to prepare 2 items:

* The widget needs a database list that contains at least 1 date field (data type = Date)
* A temporary date field (date type = Date) to store the selected date.

> Note: the temporary date field must be outside the database list of the widget! Be sure that the temporary date field is initially filled with a value (for example the current date).

**Create a database list and temporary field**

Create a database list **`To do`** with two fields:

* Date (Date type = Date)
* To do (Date type = Text)

The database list should look something like this:

<figure><img src="/files/ecaa59z3zHCJTXRMGetX" alt=""><figcaption></figcaption></figure>

Next create a temporary field. Put a single data field with the name **“Selected date”** and data type **`Date`** outside of the To Do list so it is a temporary/transient field.&#x20;

### **Create the flowchart and Use the Calendar widget in a user interaction screen**

Open the flowchart editor and drag and drop a blue interaction node on the canvas, name it **“Calendar”,** to set an initial date for the temporary field we are going to use a green `assigment node`  in our flowchart. Drag and drop a green `assigment node` (or the selected date field) on the canvas between the start and interaction node.  Next select the temporary **“Selected date”** field and change the node property action into `Advanced` and use the Date function `Today()` as the operand.

<figure><img src="/files/uzG2EfqnE9zUbvQ4frhK" alt=""><figcaption></figcaption></figure>

Double click on the `user interaction` node to open the `template editor`. Before placing the `Calendar` widget in the template, first place a adaptive column on the canvas. This is for layout reasons, because we also want to place a datagrid next to the calendar later on.

Now place the Calendar widget in the left column.&#x20;

<figure><img src="/files/h3Em1CO7BVQu8nAuU0a5" alt=""><figcaption></figcaption></figure>

Select the `Calendar` widget by clicking it once. Now you can configure the all the Calendar properties:&#x20;

1. First connect the database list to the widget. Click on the **`Event list`** property in the `Properties` pane on the right side of the screen. Select the database list **“To do”** (or drag the list to the property).&#x20;
2. Next select the date field in the database list by clicking on `Event date`. Select the **“Date”** field from the **“To do”** database list.&#x20;
3. Next select the `Selected date (by user)` property. This is the property that stores the selected date from the widget. Select the temporary field **“Selected date”**.&#x20;
4. Change the `On click action` property into **“Refresh screen”**
5. Click on preview to check your calendar.

<figure><img src="/files/tIozlJPUZ7z1544QSCKu" alt=""><figcaption></figcaption></figure>

### **Display the To Do list, create To Do activities**

Now we are going to display and manage the To Do activities on a selected date.

First we are going to show only the To Do activities for the selected date by filtering the database list:&#x20;

1. Double click on the **“Calendar”** `user interaction` node to open the template editor&#x20;
2. Select the **“To Do”** database list and place the datagrid in the right column.
3. Create a new filter on the datagrid by right clicking the filters folder and selecting new filter and enter the filtername: **“Selected date”**&#x20;
4. Enter the following filter condition: \[ToDo.Date] = \[Selected date]
5. Add the filter to the datagrid.&#x20;

<figure><img src="/files/oXl2dNbbxXqhSMccdyDd" alt=""><figcaption></figcaption></figure>

Next we are going to create new To Do activities for the selected date:&#x20;

1. Drag and drop the  `To do list` node on the canvas and select add row.
2. Open the Calendar interaction node and add a button in the top right column. Name the exit **“Add To Do”**
3. Connect the green `list` node to the “Calendar” `user interaction` node and select the **“Add To Do”** exit
4. Drag and drop the Date field to after the `add row list` node, select the assignment option, set the property action to **“Advanced”** and select the temporary field **“Selected date”** as the operand
5. Drag and drop a `user interaction` node and create an entry form for the database list **“To Do”**. You can show it as an overlay and set the overlay title as an expression: “To Do for”+” “+\[Temp.Selected date]
6. You can finish the entry form with two exit buttons (Cancel and Save) and show them in the button bar. Connect the button exits to a `Save` and `Discard all changes` node

The result should look something like this:

<div><figure><img src="/files/wcI187JDdYCWfFPHBk3D" alt=""><figcaption><p>Flowchart</p></figcaption></figure> <figure><img src="/files/ysKWoQdah1Bmpt9FPQK6" alt=""><figcaption><p>Overlay interaction node</p></figcaption></figure></div>

<figure><img src="/files/wSJ1PRB4xcUsEnJPIEhI" alt=""><figcaption></figcaption></figure>

## Properties

### General

<table><thead><tr><th width="204">Property</th><th width="181">Datatype</th><th>Description</th></tr></thead><tbody><tr><td>Events list</td><td>List, Required</td><td>The source list containing dates of events. Can be empty (no data) but should exist with at least one date-field.</td></tr><tr><td>Event date</td><td>Date, Datafield</td><td>The field in the event list containing the date to match with the Calendar display.</td></tr><tr><td>Event background color</td><td>Text, Expression</td><td>Color code for day that has Events in the List. Either use a bootstrap context such as "success", "danger", "info" or "warning". Or a CSS color value, for example: "red", "#ff0000" or "rgba(255,0,0,0.80)". Default: "info".</td></tr><tr><td>Event text color</td><td>Text, Expression</td><td>Changes the color of the event-text. Either use a bootstrap context such as "success", "danger", "info" or "warning". Or a CSS color value, for example: "red", "#ff0000" or "rgba(255,0,0,0.80)". Default: "info".</td></tr><tr><td>Event is disabled</td><td>Boolean, Expression</td><td>When day has events, day is disabled. Default false</td></tr><tr><td>Selected date</td><td>Date, Datafield</td><td>The date that is selected by User, when clicked on date in calendar. MUST be initialised PRIOR to showing widget, as it determines the month to be displayed.</td></tr></tbody></table>

### Behavior

<table><thead><tr><th width="204">Property</th><th width="181">Datatype</th><th>Description</th></tr></thead><tbody><tr><td>On click</td><td>Dropdown</td><td>When the user clicks a date, the following actions can be performed: do nothing, execute flowchart, follow button exit, refresh screen, follow navigation item.</td></tr><tr><td>Action button exit</td><td>Button Exit</td><td>Provide a button exit when the property 'On click' is set to 'follow exit'.</td></tr><tr><td>Action flowchart</td><td>Flowchart</td><td>Provide a flowchart when the property 'On click' is set to 'execute flowchart'.</td></tr><tr><td>Action navigation item</td><td>Navigation item</td><td>Provide a navigation item when the property 'On click' is set to 'follow navigation item'.</td></tr><tr><td>Disable all </td><td>Boolean, Expression</td><td>Disable click action for all days without events.</td></tr><tr><td>Disable past days</td><td>Boolean, Expression</td><td>Disable click action for days in past. Default false.</td></tr><tr><td>Disable future days</td><td>Boolean, Expression</td><td>Disable click action for days in future. Default false.</td></tr><tr><td>Disable weekends</td><td>Boolean, Expression</td><td>Disable click action for weekend days. Default false.</td></tr></tbody></table>

### Appearance

<table><thead><tr><th width="204">Property</th><th width="181">Datatype</th><th>Description</th></tr></thead><tbody><tr><td>Selected date background color</td><td>Text, Expression</td><td>Background color of selected date. Either use a bootstrap context such as "success", "danger", "info" or "warning". Or a CSS color value, for example: "red", "#ff0000" or "rgba(255,0,0,0.80)". Default: "primary"</td></tr><tr><td>Selected date text color</td><td>Text, Expression</td><td>Color of the selected date text. Either use a bootstrap context such as "success", "danger", "info" or "warning". Or a CSS color value, for example: "red", "#ff0000" or "rgba(255,0,0,0.80)". Default: "primary"</td></tr><tr><td>Today highlight color</td><td>Text, Expression</td><td>Highlighting color for today's date. Either use a bootstrap context such as "success", "danger", "info" or "warning". Or a CSS color value, for example: "red", "#ff0000" or "rgba(255,0,0,0.80)". Default: "primary"</td></tr><tr><td>Max width (in pixels)</td><td>Number, Expression</td><td>Max width of the calendar in pixels. Default: 480.</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.wem.io/platform/wemtipsandtricks/widgets/global-widgets/calendar.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
