qt6-bb10/tests/auto/corelib/time
Edward Welbourne 41f84f3ddb Give the caller control over the century used for two-digit dates
The twentieth century is now some way behind us, so using its years
when parsing a date-time format that only provides the last two digits
is increasingly likely to produce unwelcome results. Most such formats
are saved by the "redundant" presence of a day-of-week field but, for
those that are not (notably including ASN.1 date fields), there is a
need to provide some way to over-ride the twentieth century default.

Allow the caller to pass a base year to the fromString() methods, of
QDate and QDateTime, and to QLocale's toDate() and toDateTime(), that
indicates the first of 100 consecutive years, among which the two
digits given can select a year. Add some test-cases to exercise the
new API.

[ChangeLog][QtCore][QDate] When fromString() has only a two-digit year
to go on, it is now possible to set the start-year of the century
within which this selects.

[ChangeLog][QtCore][QDateTime] When fromString() has only a two-digit
year to go on, it is now possible to set the start-year of the century
within which this selects.

[ChangeLog][QtCore][QLocale] When toDate() or toDateTime() has only a
two-digit year to go on, it is now possible to set the start-year of
the century within which this selects.

Fixes: QTBUG-46843
Change-Id: Ieb312ee9e0b80557a15edcb0e6d75a57b10d7a62
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-12-08 11:40:36 +01:00
..
qcalendar Add QCalendar::matchCenturyToWeekday() 2023-12-08 11:40:36 +01:00
qdate Give the caller control over the century used for two-digit dates 2023-12-08 11:40:36 +01:00
qdatetime Give the caller control over the century used for two-digit dates 2023-12-08 11:40:36 +01:00
qdatetimeparser Use localized time-zone abbreviations or offset 2023-10-27 10:52:48 +02:00
qtime Rename Q*Ordering to Qt::*_ordering 2023-11-21 11:46:27 +01:00
qtimezone QTimeZone: use new comparison helper macros 2023-11-28 21:30:58 +01:00
CMakeLists.txt tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00