Add sample qml application
[staging/HomeScreen.git] / sample-qml / imports / components / DateTime.qml
1 /* Copyright (C) 2015, Jaguar Land Rover. All Rights Reserved.\r
2  *\r
3  * This Source Code Form is subject to the terms of the Mozilla Public\r
4  * License, v. 2.0. If a copy of the MPL was not distributed with this\r
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\r
6 \r
7 import QtQuick 2.0\r
8 import utils 1.0\r
9 \r
10 Item {\r
11     id: dateTime\r
12     anchors.left: parent.left\r
13     anchors.right: parent.right\r
14     height: 120\r
15     property var timeStamp: new Date()\r
16 \r
17     Timer {\r
18         interval: 1000\r
19         running: true\r
20         repeat: true\r
21         onTriggered: timeStamp = new Date()\r
22     }\r
23 \r
24     Label {\r
25         fontColor: Style.grey\r
26         text: Qt.formatDate(timeStamp, "ddd MMM d")\r
27     }\r
28 \r
29     Label {\r
30         anchors.right: parent.right\r
31         fontColor: Style.grey\r
32         text: Qt.formatTime(timeStamp, "h:mm AP")\r
33     }\r
34 }\r
35 \r