I cant find any decent examples of implementing the WinJS.UI.DatePicker control. Specifically I am not able to retrieve the "current" attribute from the "change" event. In my example below "eventInfo.current" is undefined?

    <h2>Date Picker Control</h2>
        <label for="datePickerDiv">
            Enter A Date:
        </label>
        <div id="date" data-win-control="WinJS.UI.DatePicker"></div>
        <div id="datePickerOutput"></div>

    //datePicker Control
    var date = document.getElementById("date");
    var datePicker = date.winControl;
    datePicker.addEventListener("change", dateChanged, false);

    function dateChanged(eventInfo) {
        var datePickerOutput = document.getElementById("datePickerOutput");
        datePickerOutput.innerText = "Selected Date: " + eventInfo.current + '.';
    }

Is current undefined or is eventInfo?
Where are you creating the datepicker object? E.g. where is this line:
var datePicker = new WinJS.UI.DatePicker(element, options);
I only looked into this briefly just now so what I'm asking is, is line 8 and 9 in your code the same as the object instantiation above?

I figured it out, was working from a bad sample code...

    function birthChanged(eventInfo) {

        //save roaming data
        var birth = document.getElementById("birth");
        var datePicker = birth.winControl;
        var appData = Windows.Storage.ApplicationData.current
        var roamingSettings = appData.roamingSettings;
        roamingSettings.values["birth"] = datePicker.current;

    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.