datatables.net-datetime
Version:
DateTime picker for DataTables.net
41 lines (33 loc) • 1.33 kB
text/xml
<dt-api library="DateTime">
<name>val()</name>
<summary>Get / set the value of the DateTime instance.</summary>
<since>1.0.0</since>
<type type="function">
<signature>val()</signature>
<description>Get the value of the DateTime instance.</description>
<returns type="Date">Date instance representing the current date selected within the DateTime instance.</returns>
</type>
<type type="function">
<signature>val(set)</signature>
<description>Set the value of the DateTime instance.</description>
<parameter type="string|Date" name="set">
The value to be set.
</parameter>
<returns type="DateTime">Self for chaining.</returns>
</type>
<description>
Get or set the value for the DateTime instance. If the set parameter is provided then a DateTime instance is provided for chaining. If not then the value stored within DateTime is returned as a Date.
</description>
<example title="Get a value from the input"><![CDATA[
let el = document.getElementById('example');
let dt = new DateTime(el);
el.addEventListener('change', function () {
console.log('Selected value is: ', dt.val());
});
]]></example>
<example title="Set a value into the input"><![CDATA[
let dt = new DateTime(document.getElementById('example'));
dt.val('2021-12-31');
]]></example>
</dt-api>