2

According to the API I should use date property, but with mode: "Hours|Minutes" the picker stays at 00:00. Is it possible somehow?

2 Answers 2

2

You can use a simple JavaScript Date Object to set a default value:

import QtQuick 2.0
import Ubuntu.Components 0.1
import Ubuntu.Components.Pickers 0.1

DatePicker {
    id: timePicker
    mode: "Hours|Minutes"
    date: new Date(0,0,0,8,5)
}

The Date object is used to work with dates and times.

Date objects are created with new Date().

There are four ways of instantiating a date:

var d = new Date();
var d = new Date(milliseconds);
var d = new Date(dateString);
var d = new Date(year, month, day, hours, minutes, seconds, milliseconds); 
0
1
        DatePicker {
                    id: timePicker
                    mode: "Hours|Minutes"
                    date: {
                        var time = new Date()
                        time.setHours(8)
                        time.setMinutes(5)
                        return time
                    }
        }

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .