Calendar
Note
DateTime.TimeOfDay is not set or changed by Calendar.
Options
Interactable
bool
Is interactable?
Date
DateTime
Current date.
Date Min
DateTime
Minimal date.
Date Max
DateTime
Maximum date.
Format
string
Format of the specified
DefaultDateMin
andDefaultDateMax
.First Day Of Week
DayOfWeek
First day of the week.
Container
RectTransform
Container for the dates.
Calendar Date Template
CalendarDateBase
Template for the date.
Header Container
RectTransform
Container for the day of weeks.
Calendar Day Of Week Template
CalendarDayOfWeekBase
Template for the day of week.
Date Text
Text
Text to display the current date.
Date Format
string
Date format for the
Date Text
.Month Text
Text
Text to display the current month.
Month Format
string
Date format for the
Month Text
.Month Button
Button
Button to open
Month Selector
Month Selector
MonthSelector
Show list of available months.
Year Button
Button
Button to open
Year Selector
Year Selector
YearSelector
Show 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();
}
}
}