Compartir a través de


DatePicker.current property

Gets or sets the current date of the DatePicker. You can use either a date string or a Date object to set this property.

Syntax

<div data-win-control="WinJS.UI.DatePicker" data-win-options="{ current : value}" ></div>
var current = datePicker.current;
datePicker.current = current;

Property value

Type: Date

The current date.

Examples

The following code shows how to get and set the current property.

<div id="dateDiv" data-win-control="WinJS.UI.DatePicker"></div>
<script type="text/javascript">
    WinJS.UI.processAll();

    var dp = document.getElementById("dateDiv").winControl;

    dp.current = "6/30/1999";
    var year = dp.current.getYear();

    // year is 99.

    dp.current = new Date("7/12/1970");
    year = dp.current.getYear();

    // year is 70.
    </script>

Requirements

Minimum WinJS version

WinJS 1.0

Namespace

WinJS.UI

See also

DatePicker