Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-114909

QLocale::toTime with ShortFormat returns invalid QTime for en_US "h:mm AP"

    XMLWordPrintable

Details

    • macOS
    • 95a74de48 (dev), d450c9420 (6.6), dddc0caab (6.5), 144e10eaf (dev), 61b2a6f58 (dev), 7bbb12b5d (6.6), bda8c5216 (6.6), 85891fb02 (6.5), 2798bf66e (6.5)
    • Foundation Sprint 86

    Description

      After upgrading from 6.4.2 to 6.5.1 some of our DateTime parsing related tests started failing.

      The following code works fine with 6.4.2 but fails with 6.5.1:

      #include <QLocale>
      #include <QDebug>
      #include <QTime>
      
      int main(){
          const QLocale usLocale{QLocale::English, QLocale::UnitedStates};
          qDebug() << usLocale.timeFormat(QLocale::ShortFormat) << usLocale.toTime("4:43 PM", QLocale::ShortFormat);
      } 

      Output:

      • 6.4.2: "h:mm AP" QTime("16:43:00.000")
      • 6.5.1: "h:mm AP" QTime(Invalid)

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Eddy Edward Welbourne
            lbuckel Leon Buckel
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: