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

Add support for hour-only forms in Q(Date)?Time::fromString(Qt::ISODate)

    XMLWordPrintable

Details

    • User Story
    • Resolution: Done
    • P3: Somewhat important
    • 6.0.0
    • 5.15.0
    • Core: Date/Time
    • None
    • All
    • 13
    • 4e675cb85e81b67f36473914f5822dd6e626ddf0 qtbase/dev

    Description

      If WikiPedia's page is to be trusted (I have no copy of the ISO spec to verify; ISO charges for specs), the time part of the ISO 8601 format may consist simply of the hour, HH, optionally with a fractional part, after a [,.] separator.
      This is not currently supported; see fromIsoTimeString().

      Our parsing should probably also support parsing the plain version of the time, with no colon separators, provided there are two, four or six digits (before any fractional-part separator), since conforming implementations of a standard should cope with what other conforming implementations generate.
      Also note that QDate::fromString() neglects to treat ISODateWithMs as an alias for ISODate; it clearly should, if only to let generic date/date-time/time code take the same spec without having to worry about which of the three it's forwarding to.

      There is also an "ordinal date" format YYYY-DDD (with the dash optional) which we should at least recognise when parsing; and a YYYY-Www with optional -D suffix, e.g. 2020-W34-3, for specifying a date by week-number. This probably deserves to be a separate format type, at least for toString() purposes, although it may make sense to parse all forms equivalently.
      Also note that 1BC is +0000 while 2BC is −0001, so the ISO year numbering doesn't match ours.

      A thorough study of the spec, together with adapting to all it implies, is in order.

      Attachments

        Issue Links

          Activity

            People

              Eddy Edward Welbourne
              Eddy Edward Welbourne
              Maurice Kalinowski Maurice Kalinowski
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 3 weeks
                  3w
                  Remaining:
                  Remaining Estimate - 3 weeks
                  3w
                  Logged:
                  Time Spent - Not Specified
                  Not Specified