Calendar
Note
DateTime.TimeOfDay is not set or changed by Calendar.
Options
Interactable
boolIs interactable?
Date
DateTimeCurrent date.
Date Min
DateTimeMinimal date.
Date Max
DateTimeMaximum date.
Format
stringFormat of the specified
DefaultDateMinandDefaultDateMax.First Day Of Week
DayOfWeekFirst day of the week.
Container
RectTransformContainer for the dates.
Calendar Date Template
CalendarDateBaseTemplate for the date.
Header Container
RectTransformContainer for the day of weeks.
Calendar Day Of Week Template
CalendarDayOfWeekBaseTemplate for the day of week.
Date Text
TextText to display the current date.
Date Format
stringDate format for the
Date Text.Month Text
TextText to display the current month.
Month Format
stringDate format for the
Month Text.Month Button
ButtonButton to open
Month SelectorMonth Selector
MonthSelectorShow list of available months.
Year Button
ButtonButton to open
Year SelectorYear Selector
YearSelectorShow list of available years.
Events
OnDateChanged
UnityEvent<DateTime>OnDateClick
UnityEvent<DateTime>
namespace UIWidgets.Examples
{
using UnityEngine;
/// <summary>
/// Test Calendar.
/// </summary>
public class TestCalendar : MonoBehaviour
{
/// <summary>
/// Calendar.
/// </summary>
[SerializeField]
protected UIWidgets.Calendar Calendar;
/// <summary>
/// Start this instance.
/// </summary>
protected virtual void Start()
{
Calendar.OnDateChanged.AddListener(ProcessDate);
// change first day of the week
Calendar.FirstDayOfWeek = System.DayOfWeek.Sunday;
// change culture (display days and months in english)
Calendar.Culture = new System.Globalization.CultureInfo("en-US");
// change culture (display days and months in french)
Calendar.Culture = new System.Globalization.CultureInfo("fr-FR");
// change calendar
SetCalendar(new System.Globalization.JapaneseCalendar());
}
void ProcessDate(System.DateTime dt)
{
Debug.Log(dt);
}
void SetCalendar(System.Globalization.Calendar calendar)
{
Calendar.Culture.DateTimeFormat.Calendar = calendar;
Calendar.UpdateCalendar();
}
}
}