Mastering Globalization: Utilizing Calendar Types in .NET MAUI Calendar Control | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (180).NET Core  (28).NET MAUI  (226)Angular  (113)ASP.NET  (49)ASP.NET Core  (81)ASP.NET MVC  (87)Azure  (41)Black Friday Deal  (1)Blazor  (236)BoldSign  (14)DocIO  (24)Essential JS 2  (110)Essential Studio  (199)File Formats  (72)Flutter  (136)JavaScript  (226)Microsoft  (121)PDF  (83)Python  (1)React  (105)Streamlit  (1)Succinctly series  (131)Syncfusion  (963)TypeScript  (33)Uno Platform  (3)UWP  (3)Vue  (46)Webinar  (53)Windows Forms  (59)WinUI  (72)WPF  (163)Xamarin  (159)XlsIO  (38)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (10)Business intelligence  (55)Button  (4)C#  (164)Chart  (147)Chart of the week  (58)Cloud  (15)Company  (440)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (73)Development  (679)Doc  (7)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (7)Essential Tools  (13)Excel  (43)Extensions  (23)File Manager  (7)Gantt  (21)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (522)Mobile MVC  (9)OLAP server  (2)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (45)Performance  (13)PHP  (2)PivotGrid  (5)Predictive Analytics  (6)Report Server  (3)Reporting  (8)Reporting / Back Office  (9)Rich Text Editor  (12)Road Map  (12)Scheduler  (54)Security  (5)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (32)Solution Services  (4)Spreadsheet  (11)SQL  (15)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (113)UI  (405)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (627)What's new  (340)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)

Mastering Globalization: Utilizing Calendar Types in .NET MAUI Calendar Control

Different regions and cultures follow distinct calendar systems, reflecting their unique traditions and historical context. These calendar systems often vary in month lengths, year starts, and year ends. In today’s globalized world, developing applications that cater to users from diverse cultures and regions is essential.

The Syncfusion .NET MAUI Calendar control provides different calendar types, enabling developers to cater to a broader user base and users to interact with dates according to their cultural or regional preferences.

In this blog, we’ll explore the different calendar types and their basic functionalities in the .NET MAUI Calendar control.

Note: If you are new to this control, refer to the .NET MAUI Calendar getting started documentation for background knowledge.

Different calendar types

The .NET MAUI Calendar supports different calendar types and displays dates, months, and years based on the one specified. Gregorian is the default calendar type.

Types

Description

Gregorian

This type of calendar is the most widely used civil calendar worldwide. The minimum supported date value is 01/01/01, and the maximum supported date value is 31/12/9999. The current year of the Gregorian calendar is 2023.

Hijri

This calendar type is mostly used in Saudi Arabia and the United Arab Emirates. The minimum supported date value is 01/01/01 (in Gregorian 18/07/622), and the maximum supported date value is 03/04/9666 (in Gregorian 31/12/9999). The current year of the Hijri calendar is 1444.

Korean

This type of calendar is very much like the Gregorian calendar and it only supports the current era. The minimum supported date value is 01/01/2334 (in Gregorian 01/01/01), and the maximum supported date value is 31/12/9999 (in Gregorian 31/12/12332). The current year of the Korean calendar is 4356.

Persian

This type of calendar is mostly used in Iran. The minimum supported date value is 01/01/01 (in Gregorian 21/03/622), and the maximum supported date value is 13/10/9378 (in Gregorian 31/12/9999). The current year of the Persian calendar is 1402.

Taiwan

This type of calendar, too, is like the Gregorian calendar and only supports the current era. The minimum supported date value is 01/01/01 (in Gregorian 01/01/1912), and the maximum supported date value is 31/12/8088 (in Gregorian 31/12/9999). The current year of the Taiwan calendar is 112.

Thai

This type of calendar is exactly like the Gregorian calendar and only supports the current era. The minimum supported date value is 01/01/544 (in Gregorian 01/01/01), and the maximum supported date value is 31/12/10542 (in Gregorian 31/12/9999). The current year of the Thai calendar is 2566.

UmAlQura

This type of calendar represents the Saudi Hijri calendar and is nearly identical to the Hijri calendar. The minimum supported date value is 01/01/1318 (in Gregorian 30/04/1900), and the maximum supported date value is 29/12/1450 (in Gregorian 13/05/2029). The current year of the  UmAlQura calendar is 1444.

You can easily change the calendar type using the Identifier property in the SfCalendar. Refer to the following code example.

<calendar:SfCalendar x:Name="Calendar" Identifier="Hijri"> 
</Calendar:SfCalendar>
Hijri calendar type in .NET MAUI Calendar
Hijri calendar type in .NET MAUI Calendar

Different calendar views

The .NET MAUI Calendar control enriches the experience of using different calendar types by incorporating various calendar views, including month, year, decade, and century views. These distinct views offer versatile options for interacting with dates, months, and years based on the specified calendar type.

Hijri Month view in .NET MAUI CalendarHijri Year view in .NET MAUI Calendar
Hijri Decade view in .NET MAUI CalendarHijri Century view in .NET MAUI Calendar

Different calendar views in .NET MAUI Calendar control

You can change the calendar view using the View property in the SfCalendar. Refer to the following code example.

<calendar:SfCalendar x:Name="Calendar" Identifier="Hijri" View="Month"> 
</Calendar:SfCalendar>

Specifying the date value

When working with different calendar types in the .NET MAUI Calendar, you can assign a date value to its properties in two ways.

Generating a date

You can create a date value by declaring the calendar type while creating the date instance.

Refer to the following code example. Here, we’ve declared the date by specifying the calendar type as Hijri.

SfCalendar calendar = new SfCalendar();
Calendar hijriCalendar = new HijriCalendar();
DateTime date = new DateTime(1444, 12, 6, hijriCalendar);
calendar.SelectedDate = date;

Generating a date without calendar type

You can also create a date value without explicitly specifying the calendar type. In this case, the .NET MAUI Calendar will automatically convert and interpret the date value based on the specified local system’s calendar type.

Refer to the following code example. Here, we’ve used the Gregorian date, but the .NET MAUI Calendar control converts it to the corresponding Hijri calendar date.

SfCalendar calendar = new SfCalendar();
DateTime date = new DateTime(2023, 6, 24);
calendar.SelectedDate = date;
Specifying the date value in .NET MAUI Calendar
Specifying the date value in the .NET MAUI Calendar

Specifying the flow direction

The .NET MAUI Calendar control automatically adjusts the flow direction based on the specified calendar type. This means that when you choose a calendar type with a right-to-left flow direction, such as in the Arabic calendar, the .NET MAUI Calendar control will automatically display the calendar elements in a right-to-left orientation.

The right-to-left supported calendar types in the .NET MAUI Calendar are:

  • Hijri
  • Persian
  • UmAlQura

Conclusion

Thanks for reading! In this blog, we have explored the various calendar types available in the Syncfusion .NET MAUI Calendar control and their versatile features. With this, you can enhance the experience of your global users.

Explore other features in the Calendar control in its documentation. Try out the .NET MAUI demos available on GitHub and share your feedback or ask questions in the comments section.

If you are not a Syncfusion customer, try our 30-day free trial to see how our components can enhance your productivity.

You can also contact us through our support forumsupport portal, or feedback portal. We are always happy to assist you!

Test Flight
App Center Badge
Google Play Store Badge
Microsoft Badge
Github Store Badge

Related Blogs

Tags:

Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed