DatePicker

Calendar widget that appears in Aside. Used in Forms for an implementation of <input type="date"> elements.

The DatePicker can be launched with a JavaScript API. You should implement the onselect method to get notified whenever the user picks a date. Note that you must manually open and close the DatePicker.

var datePicker = ts.ui.DatePicker({
	title: "Your Birthday",
	value: '1973-03-26',
	onselect: function(newval, oldval) {
		ts.ui.Notification.success(this.value);
		this.close();
	},
	onclosed: function() {
		this.dispose();
	}
});
datePicker.open();

You can specify a min and max value.

ts.ui.DatePicker({
	title: "Your Birthday",
	value: '1984-05-23',
	min: '1984-01-01',
	max: '1985-12-24',
	onselect: function() {
		this.close();
	},
	onclosed: function() {
		this.dispose();
	}
}).open();

The object argument configures a ts.ui.DatePickerModel as outlined below.

ts.ui.DatePickerModel
Instance properties
title {string} Appears as the title of the DatePicker
value {string} The selected date. Must be dash-separated, ISO 8601 formatted date string e.g. 2015-01-01
Instance methods
open {void} Open the DatePicker
close {void} Close the DatePicker
onselect {void} Called whenever selection changes with two arguments newval and oldval.
onclosed {void} Event listener for close event. Called after aside closing animation is completed.
dispose {void} Cleanup the DataPicker (recommended)