Fix folio dates a century early in the project database

diagram_info.date -- and project_summary_view.date, which the summary
table dialog queries -- held the folio date read back from the title
block's text: QLocale::system().toDate() of the string
updateDiagramContextForTitleBlock() writes in the locale's short format.
Where that format has a two-digit year (en_US "M/d/yy") Qt reads the year
back as 19xx, so 741.qet's 2010-09-21 became 1910-09-21, and so did every
dated folio of the 24 examples (109 of 109).

bindDiagramInfoValues() now binds the folio's own date,
BorderTitleBlock::date(), the value that text was made from. A folio set
to show the current date or none gives the same date as before.

tst_dbfoliodate runs --run on examples/741.qet under LC_ALL=en_US.UTF-8
and expects 2010-09-21 from project_summary_view: 1910-09-21 without this
change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-09-29 14:14:15 +13:00
parent fdcdfd749e
commit 3139fa54f7
3 changed files with 90 additions and 3 deletions
+6 -3
View File
@@ -1741,9 +1741,12 @@ void projectDataBase::bindDiagramInfoValues(QSqlQuery &query, Diagram *diagram)
for (auto key : QETInformation::diagramInfoKeys())
{
if (key == "date") {
query.bindValue( ":date",
QLocale::system().toDate(infos.value("date").toString(),
QLocale::ShortFormat));
//The folio's own date, not the title block's text read
//back: that text is the locale's short format, and where
//it has a two-digit year (en_US "M/d/yy") toDate() reads
//2010 back as 1910.
query.bindValue(QStringLiteral(":date"),
diagram->border_and_titleblock.date());
} else {
auto value = infos.value(key);
auto bind = key.prepend(":");