Ask / Submit

Shorten the weekday name/date on Lockscreen clock [answered]

asked 2016-07-30 15:50:58 +0300

Edz gravatar image

As the title suggests, how do I shorten the Weekday name on the Lockscreen?, I don't understand the mechanism for time/day/date construction using QML in Sailfish.

For example, I want to reduce each Weekday name down to 3 letters only; `Sun, Mon; Tue; Wed; Thu; Fri, Sat' and eventually, reduce the date to one line.

The text in the relevant Clock.qml file gives this line of text;

    text: {
        var day = Format.formatDate(time, Format.WeekdayNameStandalone)
        return day[0].toUpperCase() + day.substring(1)

The above code simply returns; Saturday - but I'd like to see Sat 30 Jul

For the month, the text also in Clock.qml gives this line;

    text: Format.formatDate(time, Format.DateMediumWithoutYear)

The above simply displays; 30 Jul which is what I'm after, as previously described.

Any info appreciated

edit retag flag offensive reopen delete

The question has been closed for the following reason "the question is answered, an answer was accepted" by Edz
close date 2016-07-30 18:07:00.004304



isnt there a subString(startpos,length) ?

i would try day =day.substring(0,3)

pawel ( 2016-07-30 17:22:48 +0300 )edit

Thanks @pawel, you may well be right, but meanwhile, I have worked out another way and have achieved what I was after; the date in short form, i.e. Sat 30 Jul.

Edz ( 2016-07-30 18:01:40 +0300 )edit

1 Answer

Sort by » oldest newest most voted

answered 2016-07-30 18:04:26 +0300

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

updated 2016-09-17 13:48:57 +0300

Edz gravatar image

I have answered my own question, but I'll leave the result here as others may find it useful.

    text: { updatesEnabled: timeText.time
        Qt.formatDateTime(new Date(), "ddd dd MMM")

The above now returns; Sat 30 Jul

image description

edit flag offensive delete publish link more


Above EDITED; to reflect how the DATE mechanism updates. My initial solution did not include updatesEnabled: timeText.time - as a direct result, the DATE was not updating on the stroke of MIDNIGHT.

Edz ( 2016-08-01 12:46:44 +0300 )edit

Question tools

1 follower


Asked: 2016-07-30 15:50:58 +0300

Seen: 239 times

Last updated: Sep 17 '16