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

Research and implement QDateTime/etc. <=> C++20 calendaring integration

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • None
    • Core: Date/Time
    • None

      C++20 added calendaring support to C++. Qt classes should offer integrations for them.

      (At the time of this writing, calendaring is not widely implemented, but one could experiment against HH's library on GitHub.)

      Things that come into mind:

      • QDate should have conversion from/to std::chrono::year_month_day done
      • QTime could support conversion from/to durations (which would take care of std::chrono::hh_mm_ss since it is interconvertible with them).
      • QDateTime should have conversions from/to zoned_time, and also possibly system_clock / utc_clock as well done;
      • and convenience constructors and getters from combinations of std::chrono::year_month_day + time zone, etc. (see 2023/Nov/23 comment).
      • QTimeZone conversion from/to std::chrono::time_zone (may be not possible in general but only for named zones)QTBUG-68812

      The goal would be to avoid reimplementing date time math in Qt (which seems to be a fairly popular request) and just let people use the std or HH's facilities, but have then easy-to-use conversions if they want to locale-format a date, store it using QtSQL, etc.

      (Of course we might even go all in and provide formatting etc. for std::chrono classes, without conversions)

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

            Eddy Edward Welbourne
            peppe Giuseppe D'Angelo
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes