Search
Calendar.locale Property
See Also
 






Gets or sets the locale object used to format and display localizable information in the calendar.

Namespace: MindFusion.Common.UI
File: Calendar.js

 Syntax

JavaScript  Copy Code

get locale() {}

 Property Value

An instance of the Locale class.

 Example

The following code creates a new Calendar instance using a reference to an HTML div with an id "calendar". The view is set to DayView and the date is 25th of June, 2020. The hour is 14:58. The locale property is used to specify the format of the date and time.

JavaScript  Copy Code

var locale = new Locale("us-2");

locale.dateSettings.firstDayOfWeek = 0;
locale.dateSettings.dateSeparator = "/";
locale.dateSettings.timeSeparator = ":";
locale.dateSettings.dayPeriodAM = "AM";
locale.dateSettings.dayPeriodPM = "PM";

locale.dateSettings.dateFormats.shortDate = "MM/d/yyyy";
locale.dateSettings.dateFormats.shortTime = "h:mm tt";
locale.dateSettings.dateFormats.shortDateTime = "MM/d/yyyy h:mm tt";
locale.dateSettings.dateFormats.longDate = "dddd, MMMM dd, yyyy";
locale.dateSettings.dateFormats.longTime = "h:mm:ss tt";
locale.dateSettings.dateFormats.longDateTime = "dddd, MMMM dd, yyyy h:mm:ss tt";
locale.dateSettings.dateFormats.dayMonth = "d/MM";
locale.dateSettings.dateFormats.yearMonth = "MMMM, yyyy";

locale.dateSettings.generate();

var calendar = u.Calendar(document.getElementById("calendar"));
calendar.view = new u.DayView();
calendar.date = new Date(2020, 5, 25, 14, 58, 0, 0);
calendar.locale = locale;

 See Also