Logo
UI Elements

Calendar

Choose dates within an optional allowed range

Overview

Calendar provides a month view, date selection, and optional date limits. Its entries are cached before runtime, and the v2 editor supports live changes.

Preview

Usage

Create a Calendar prefab with its day grid, month and year dropdowns, and navigation buttons.

Choose the initial date behavior in the Inspector.

Set minimum and maximum dates if your application has a permitted range.

Listen to On Date Selected for a System.DateTime value.


Tips

  • Edit the day preset and its Styler mappings for normal, selected, and unavailable dates.
  • Month labels can use Evo Localization when the integration is enabled.

Public API

Use Calendar in the Evo.UI namespace.

Properties

NameTypeDescription
HighlightTodayboolMarks today's date, month, and year.
TransitionDurationfloatZoom and slide duration in seconds. Zero switches instantly.
ZoomScalefloatScale difference when zooming between views, from 0 to 0.5.
SlideDistancefloatPage slide distance relative to the grid, from 0 to 1.

Methods

NameParametersDescription
SelectDate()DateTime date, bool invokeEvents = trueSelects a date, optionally suppressing its event.
GetSelectedDate()NoneReturns the selected date or null. Returns DateTime?.
ClearSelection()NoneClears the selected date.
SetMinDate()DateTime dateSets the earliest allowed date.
SetMaxDate()DateTime dateSets the latest allowed date.
SetYearRange()int rangeChanges the available year range.
GoToToday()NoneNavigates to the current month.
SelectToday()NoneSelects today’s date.
Refresh()NoneRefreshes the calendar view.

Events

NameTypeDescription
onDateSelectedUnityEvent<DateTime>Invoked with the selected DateTime.

Example

CalendarExample.cs
using UnityEngine;
using Evo.UI;

public class CalendarExample : MonoBehaviour
{
    [SerializeField] private Calendar target;

    private void Start()
    {
        target.SetMinDate(System.DateTime.Today);
        target.SelectDate(System.DateTime.Today, false);
        target.onDateSelected.AddListener(date => Debug.Log(date.ToString("yyyy-MM-dd")));
    }
}

On this page