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

QDateTimeFormat is wrong?

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 6.6
    • Core: Date/Time
    • None
    • All

    Description

      I parsed sample dt format "ddd, dd MMM yyyy H:m:s" and tried to "fromString" some sample dt string "Fri, 12 Apr 2024 5:23:57". Output:

      time="     0.143" type="debug" -> parseFormat: ddd, dd MMM yyyy H:m:s
      time="     0.143" type="debug" -> "ddd, dd MMM yyyy H:m:s" "ddd, dd MMM yyyy H:m:s"
      time="     0.143" type="debug" -> separators:
      '
      , 
       
       
       H:m:s'
      time="     0.158" type="debug" -> parse "Fri, 12 Apr 2024 5:23:57"
      time="     0.163" type="debug" -> sectionValue for "DayOfWeekSectionShort" with text "Fri, 12 Apr 2024 5:23:57" and (at 0 ) st: "Fri"
      time="     0.163" type="debug" -> sectionValue "DayOfWeekSectionShort" "Fri, 12 Apr 2024 5:23:57" pos 0 used 3 "Acceptable"
      time="     0.163" type="debug" -> 0 "DayOfWeekSectionShort" is set to 3 state is "Acceptable"
      time="     0.168" type="debug" -> sectionValue for "DaySection" with text "Fri, 12 Apr 2024 5:23:57" and (at 5 ) st: "12"
      time="     0.168" type="debug" -> "12" 12 2
      time="     0.168" type="debug" -> sectionValue "DaySection" "Fri, 12 Apr 2024 5:23:57" pos 5 used 2 "Acceptable"
      time="     0.168" type="debug" -> 1 "DaySection" is set to 7 state is "Acceptable"
      time="     0.173" type="debug" -> sectionValue for "MonthSection" with text "Fri, 12 Apr 2024 5:23:57" and (at 8 ) st: "Apr"
      time="     0.173" type="debug" -> sectionValue "MonthSection" "Fri, 12 Apr 2024 5:23:57" pos 8 used 3 "Acceptable"
      time="     0.173" type="debug" -> 2 "MonthSection" is set to 11 state is "Acceptable"
      time="     0.178" type="debug" -> sectionValue for "YearSection" with text "Fri, 12 Apr 2024 5:23:57" and (at 12 ) st: "2024"
      time="     0.178" type="debug" -> "2024" 2024 4
      time="     0.179" type="debug" -> sectionValue "YearSection" "Fri, 12 Apr 2024 5:23:57" pos 12 used 4 "Acceptable"
      time="     0.179" type="debug" -> 3 "YearSection" is set to 16 state is "Acceptable"
      time="     0.179" type="debug" -> invalid because " 5:23:57" does not match " H:m:s" 16
      time="     0.179" type="debug" -> 'Fri, 12 Apr 2024 5:23:57' => ''(Invalid)
      

      What baffles me that is says that:

      > invalid because " 5:23:57" does not match " H:m:s"

      How come? it looks like to me it should clearly match. As result, the dt string is not parse to QDateTime instance.

      Attachments

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

        Activity

          People

            Eddy Edward Welbourne
            skunkos Martin Rotter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes