aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllocale/data/date.qml
blob: 3f58497d22a8a4790e1498b77118e22178b3f0c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import QtQuick 2.0

QtObject {
    property var locale: Qt.locale()

    function setLocale(l) {
        locale = Qt.locale(l)
    }

    function toLocaleString(fmt) {
        var d = new Date(2011, 9, 7, 18, 53, 48, 345);
        if (fmt < 0)
            return d.toLocaleString(locale);
        else
            return d.toLocaleString(locale, fmt);
    }

    function toLocaleDateString(fmt) {
        var d = new Date(2011, 9, 7, 18, 53, 48, 345);
        if (fmt < 0)
            return d.toLocaleDateString(locale);
        else
            return d.toLocaleDateString(locale, fmt);
    }

    function toLocaleTimeString(fmt) {
        var d = new Date(2011, 9, 7, 18, 53, 48, 345);
        if (fmt < 0)
            return d.toLocaleTimeString(locale);
        else
            return d.toLocaleTimeString(locale, fmt);
    }

    function fromLocaleString(d,fmt) {
        return Date.fromLocaleString(locale, d, fmt)
    }

    function fromLocaleDateString(d,fmt) {
        return Date.fromLocaleDateString(locale, d, fmt)
    }

    function fromLocaleTimeString(d,fmt) {
        return Date.fromLocaleTimeString(locale, d, fmt)
    }
}