qt5base-lts/tests/auto/corelib
Giuseppe D'Angelo 2e29f55f76 QDate: add conversions for std::chrono calendaring classes
std::chrono::year_month_day and related classes offer very
convenient to specify dates.

This patch adds implicit constructors to QDate to support this
convenience, e.g.:

  // YYYY-MM-DD, DD-MM-YYYY, MM-DD-YYYY formats:
  QDate d1 = 1985y / December / 8;
  QDate d2 = 8d / December / 1985;
  QDate d3 = December / 8d / 1985;

  // Indexed weekday:
  QDate d4 = 2000y / January / Monday[0];
  QDate d5 = 2000y / January / Monday[last];

and so on.

These are all implemented using the conversion from the std
calendaring classes to sys_days. Conversions between sys_days
and QDate are also added, since they're basically "for free".

I don't expect "ordinary" users to stumble upon it, but it's
worthy mentioning that std::chrono::year *does* have a year
zero (hence, year_month_day in year 0 or below are offset
by one with the corresponding QDate). I've left a note
in the documentation.

[ChangeLog][QtCore][QDate] QDate (and therefore QDateTime)
is now constructible using the year/month/day/week classes
available in the std::chrono library. Moreover, it now
features conversions from and to std::chrono::sys_days.

Change-Id: I2a4f56423ac7d1469541cbb6a278a65b48878b4a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-13 18:08:38 +02:00
..
animation tst_qanimationgroup: fix memleaks 2022-01-05 08:22:00 +01:00
global Move some purely floating-point testing from tst_QLocale to tst_QNumeric 2022-04-01 23:11:35 +02:00
io Ensure that readAllStandardError() doesn't crash on assert 2022-04-09 20:31:11 +02:00
itemmodels QAbstractProxyModel: do not access invalid indexes 2022-04-13 18:08:38 +02:00
kernel Replace uses of _qs with _s in tests 2022-04-07 19:30:17 +02:00
mimetypes Tests: Do not depend on transitive includes 2022-03-17 17:14:37 +01:00
platform Android: Add runOnMainAndroidThread() under QNativeInterface 2021-05-26 23:24:11 +00:00
plugin Android: activate tst_QPluginLoader 2022-03-30 19:05:59 +02:00
serialization Skip test that fails with Address Sanitizer enabled 2022-04-12 00:48:17 +02:00
text Fix assertion failure when parsing a doubly-invalid date-time text 2022-04-07 23:04:04 +02:00
thread Replace uses of _qs with _s in tests 2022-04-07 19:30:17 +02:00
time QDate: add conversions for std::chrono calendaring classes 2022-04-13 18:08:38 +02:00
tools QVarLengthArray: add missing (size, value) ctor 2022-04-13 08:10:47 +02:00
CMakeLists.txt Add tests for QAndroidApplication's sdkVersion and activity 2021-05-13 01:41:36 +03:00