Class CalendarBase<T>
The Calendar is a graphical user interface component that displays a Gregorian Calendar, and allows a user to select a date.
Inheritance
Inherited Members
Namespace: Syncfusion.Blazor.Calendars
Assembly: Syncfusion.Blazor.dll
Syntax
public class CalendarBase<T> : SfInputTextBase<T>
Type Parameters
Name | Description |
---|---|
T | Specifies the type of CalendarBase. |
Constructors
CalendarBase()
Declaration
public CalendarBase()
Properties
CalendarEditContext
Specifies the editcontext of the Calendar.
Declaration
protected EditContext CalendarEditContext { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.Forms.EditContext |
CalendarMode
Sets the calendar's type like Gregorian.
Declaration
public CalendarType CalendarMode { get; set; }
Property Value
Type |
---|
CalendarType |
DayHeaderFormat
Specifies the format of the day that to be displayed in the header. By default, the format is short.
Possible formats are:
- ShortSets the short format of day name (like Su ) in day header.
- NarrowSets the single character of day name (like S ) in day header.
- AbbreviatedSets the min format of day name (like Sun ) in day header.
- WideSets the long format of day name (like Sunday ) in day header.
Declaration
public DayHeaderFormats DayHeaderFormat { get; set; }
Property Value
Type |
---|
DayHeaderFormats |
Depth
Sets the maximum level of views such as a month, year, and decade in the calendar.
The depth view should be smaller than the start view to restrict its view navigation.
Declaration
public CalendarView Depth { get; set; }
Property Value
Type |
---|
CalendarView |
FirstDayOfWeek
Sets the calendar's first day of the week. By default, the first day of the week will be based on the current culture.
Declaration
public int FirstDayOfWeek { get; set; }
Property Value
Type |
---|
System.Int32 |
KeyConfigs
Customizes the key actions in the calendar.
For example, when using a German keyboard, the key actions can be customized using these shortcuts.
Declaration
public Dictionary<string, object> KeyConfigs { get; set; }
Property Value
Type |
---|
System.Collections.Generic.Dictionary<System.String, System.Object> |
Max
Gets or sets the maximum allowable date or time value.
Declaration
public virtual DateTime Max { get; set; }
Property Value
Type |
---|
System.DateTime |
Min
Specifies a minimum date that is allowed a user can select in the calendar.
Declaration
public virtual DateTime Min { get; set; }
Property Value
Type |
---|
System.DateTime |
ServerTimezoneOffset
By default, the date value will be processed based on the system time zone.
If you want to process the initial date value using the server time zone then specify the time zone value to the ServerTimezoneOffset property.
Declaration
public double ServerTimezoneOffset { get; set; }
Property Value
Type |
---|
System.Double |
ShowTodayButton
Specifies whether the today button will be displayed in the calendar.
Declaration
public bool ShowTodayButton { get; set; }
Property Value
Type |
---|
System.Boolean |
Start
Specifies the initial view of the calendar when it is opened. With the help of this property, the initial view can be changed to the year or decade view.
Declaration
public CalendarView Start { get; set; }
Property Value
Type |
---|
CalendarView |
WeekNumber
Specifies whether the week number of the year will be displayed in the calendar.
Declaration
public bool WeekNumber { get; set; }
Property Value
Type |
---|
System.Boolean |
WeekRule
Specifies the rule for defining the first week of the year.
Declaration
public CalendarWeekRule WeekRule { get; set; }
Property Value
Type |
---|
System.Globalization.CalendarWeekRule |
Methods
ChangeEvent(EventArgs, Boolean)
Triggers when the value get changed.
Declaration
protected virtual void ChangeEvent(EventArgs args, bool isSelection = false)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | args | Specifies the System.EventArgs. |
System.Boolean | isSelection | Determines whether selection is made using the mouse or keyboard. |
ConvertDateValue(T)
Declaration
protected DateTime ConvertDateValue(T dateValue)
Parameters
Type | Name | Description |
---|---|---|
T | dateValue |
Returns
Type |
---|
System.DateTime |
ConvertToGregorian(String, String)
Converts a formatted Hijri date string to a Gregorian System.DateTime object.
Declaration
public T ConvertToGregorian(string hijriDate, string format)
Parameters
Type | Name | Description |
---|---|---|
System.String | hijriDate | The Hijri date string to convert, formatted according to the specified |
System.String | format | The format string that specifies the structure of the |
Returns
Type | Description |
---|---|
T | A System.DateTime object in Gregorian format representing the date and time specified in the Hijri |
Remarks
This method splits the hijriDate
and format
into individual components,
parses each component to extract day, month, year, and time values, and converts them from Hijri to Gregorian.
It assumes that the hijriDate
is in the Hijri calendar.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
ConvertToHijri(T, String)
Converts a Gregorian System.DateTime object to a formatted Hijri date string.
Declaration
public string ConvertToHijri(T gregorianDate, string format)
Parameters
Type | Name | Description |
---|---|---|
T | gregorianDate | The Gregorian date to be converted to Hijri, of type |
System.String | format | The format string specifying the output structure of the Hijri date. Supports standard date format specifiers such as "dd", "MM", "MMM", "MMMM", "yyyy", and time components. |
Returns
Type | Description |
---|---|
System.String | A string representing the Hijri date formatted according to the specified |
Remarks
This method converts a System.DateTime value from Gregorian to Hijri and formats it. If the format string contains "MMM" or "MMMM", it replaces the month part with a Hijri month name (abbreviated or full, depending on the format).
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
GetDefaultFormat()
Declaration
protected string GetDefaultFormat()
Returns
Type |
---|
System.String |
GetHijriMonthIndex(String, String)
Declaration
protected int GetHijriMonthIndex(string monthName, string format)
Parameters
Type | Name | Description |
---|---|---|
System.String | monthName | |
System.String | format |
Returns
Type |
---|
System.Int32 |
ReplaceMonthName(String, DateTime, String[], String)
Declaration
protected static string ReplaceMonthName(string formattedDate, DateTime finalDate, string[] hijriMonths, string format)
Parameters
Type | Name | Description |
---|---|---|
System.String | formattedDate | |
System.DateTime | finalDate | |
System.String[] | hijriMonths | |
System.String | format |
Returns
Type |
---|
System.String |