Calendar identifier in .NET MAUI Calendar (SfCalendar)

19 Sep 20242 minutes to read

The .NET MAUI Calendar supports Calendar Identifier to display the different types of calendars based on various cultures and regions. The supported identifiers are Gregorian, Hijri, Korean, Persian, Taiwan, ThaiBuddhist, and UmAlQura. Change the calendar identifier using the Identifier property in the SfCalendar.

Supported Calendars UnSupported Calendars
* GregorianCalendar
* HijriCalendar
* KoreanCalendar
* PersianCalendar
* TaiwanCalendar
* ThaiCalendar
* UmAlQuraCalendar
* Gezer Calendar
* Haida Calendar
* Igbo calendar
* Islamic calendar
* Javanese calendar
* Maramataka (Maori lunar calendar)
* Nepal Sambat
* HebrewCalendar
* JulianCalendar
* JapaneseCalendar
* Yoruba calendar

NOTE

  • The Flow Direction will be updated based on the calendar identifier. All the DateTime values, such as DisplayDate, MinimumDate, MaximumDate, SelectedDate, SelectedDates, SelectedDateRange, SelectableDayPredicate, and SpecialDayPredicate, can be given in two ways.
  • The DateTime instance without specifying calendar identifier. The calendar will handle the DateTime value for the specified calendar identifier.
  • When a DateTime instance has a calendar identifier, the calendar handles it directly.
  • View header will show full week day name for all the calendar identifiers except Gregorian Calendar while the text format is “ddddd”.
<calendar:SfCalendar x:Name="calendar"
					   Identifier="Hijri">
</calendar:SfCalendar>
SfCalendar calendar = new SfCalendar();
calendar.Identifier = CalendarIdentifier.Hijri;
this.Content = calendar;

DateTime values in Calendar identifiers

All the DateTime properties of the calendar can be given in two ways when the calendar identifier is specified other than the GregorianCalendar.

  • Create an display date value by declaring the calendar identifier and respective calendar identifier date.
<calendar:SfCalendar x:Name="calendar" />
this.calendar.Identifier = CalendarIdentifier.Hijri;
this.calendar.DisplayDate = new DateTime(1444, 11, 21, 0, 0, 0, new HijriCalendar());
  • Create an display date value by declaring the local system date. In this case, the system date will be converted to the respective calendar identifier date.
<calendar:SfCalendar x:Name="calendar" />
this.calendar.Identifier = CalendarIdentifier.Hijri;
this.calendar.DisplayDate = new DateTime(2023, 6, 9);

Multiple views of Calendar identifier in .NET MAUI Calendar.