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

QDateEdit fails to disambiguate centuries (Y2K bug)

    XMLWordPrintable

Details

    Description

      I'm trying out qtbase/examples/widgets/itemviews/customsortfiltermodel which looks like this by default:

      Just from the appearance, I expect that the date range from 1/1/70 to 12/31/99 should be completely within the previous century; but actually it's filtering from 1970 to 2099 (which is the only reason any of those "emails" are included by the filter):

      window.cpp:    fromDateEdit->setDate(QDate(1970, 01, 01));
      window.cpp:    toDateEdit->setDate(QDate(2099, 12, 31));
      

      Being confused about 1999 vs 2099 and attempting to "correct" this date range interactively is also confusing, and thus mostly futile unless you already understand (without seeing it) that 99 really means 2099. Having one set of spinbox arrows to adjust the whole date makes little sense, but that's how this widget is designed: you have to put the cursor into the field you want to change. You can also type a 2-digit year, but not 4 digits! Suppose I change 99 to 93. Which year is that? As it turns out, if I do that and then change it back to 99, all rows are filtered out. So probably that's one way to change it to 1999. Now how do I get back to 2099?

      The example could at least set the calendarPopup property.

      But why should it show 2-digit years at all, when we can already tell programmatically that the date range covers a longer period of time than just the period when 2-digit years were considered to be ok? Maybe I should blame the locale for specifying 2-digit years; but in this case it's clearly not useful. So should we override the locale and use 4-digit years in such a case, or should we consider it an upstream bug somewhere? TBH I'm not sure where this comes from. My relevant env vars:

      LANG=en_US.UTF-8
      LANGUAGE=
      

      and no LC vars are set.

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              srutledg Shawn Rutledge
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes