Search
DateTimePicker.locale Property
See Also
 






Gets or sets the locale object used to format and display dates.

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

 Syntax

JavaScript  Copy Code

get locale() {}

 Property Value

A Locale instance.

 Example

The following code creates a new DateTimePicker using an HTML div element with an id "date_picker". The dateTimePicker uses a Locale instance to format the rendered date and time values.

JavaScript  Copy Code

var u = MindFusion.Common.UI;

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 dateTimePicker = new ui.DateTimePicker(document.getElementById("date_picker"));
//advance for 1 day
dateTimePicker.advance(0, 0, 1);
dateTimePicker.autoComplete = true;
dateTimePicker.datePartSelect = true;
dateTimePicker.format = "d/MMMM";
//1 hour in milliseconds
dateTimePicker.interval = 3600000;
dateTimePicker.locale = locale;

 See Also