QML Locale bindings not formatting time correctly

Anant Kamath kamathanant at gmail.com
Thu Apr 11 19:54:21 UTC 2013


Okay so I guess this IS a bug.

I fixed it by adding Q_FLAGS(TimeFormatOptions) in
kde-runtime/plasma/declarativeimports/locale/locale_p.h
and rebuilding. The QML code now works as expected.

I file a review request for the same.

--
Anant Kamath


On 11 April 2013 15:53, Anant Kamath <kamathanant at gmail.com> wrote:

> Some functions in the QML Locale bindings (in KDE 4.10.1) seem to be
> ignoring some flags:
>
> For example->
> This QML code:
>
> -----------------
> Locale {
>             id: locale
>  }
>
> PlasmaComponents.Label {
>         text: locale.formatLocaleTime(  "11:12:13",
> Locale.TimeWithoutAmPm  )
>  }
>
> ---------------------
>
> returns the time as 11:12:13 AM
>  which is incorrect, as the AM should not be visible. i.e. correct output
> should be 11:12:13
>
> Similarly,
>
> text: locale.formatLocaleTime( "11:12:13", Locale.TimeWithoutSeconds )
>
> still returns 11:12:13 AM,
> when the output should be 11:12 AM
>
> The actual KLocale::formatLocaleTime() function in C++ ofcourse, works
> correctly.
>
> Is there anything wrong in my QML code or is this a bug?
>
> --
> Anant Kamath
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20130412/a3c5386e/attachment.html>


More information about the Plasma-devel mailing list