Description: Fix date truncation error when passing timestamps for section dates
 For the code to work as intended, timestamps have to be passed to the
 JavaScript engine in the form of 'YYYY-MM-DDT00:00:00.0Z<TZnAME>',
 otherwise toLocaleDateString() will assume it to be UTC again and
 add/subtract the TZ offset a second time.
Author: Dennis Filder <d.filder@web.de>
Bug-Debian: https://bugs.debian.org/983369
Forwarded: TBD
Last-Update: 2022-01-08
--- a/linphone-app/src/components/history/HistoryModel.cpp
+++ b/linphone-app/src/components/history/HistoryModel.cpp
@@ -112,7 +112,21 @@
 		return QVariant::fromValue(data);
 	}
 	case Roles::SectionDate:
-		return QVariant::fromValue(mEntries[row].first["timestamp"].toDate());
+          if (getenv("LINPHONE_DEBUG_SECTIONDATE")) {
+            qDebug() << mEntries[row].first["timestamp"]/*.toDate()*/;
+          }
+          QDateTime dt(mEntries[row].first["timestamp"].toDateTime());
+          dt.setTime(QTime()); // We truncate the timestamp to
+                               // 00:00:00.0 here since we only want
+                               // one section date per day, but we
+                               // must use ISODate to loop through the
+                               // TZ so toLocaleDateString() knows
+                               // what TZ to convert from.  Before the
+                               // code just passed a TZ-less timestamp
+                               // which led to double-truncation and
+                               // the date being off by 1 day for
+                               // people in TZs West of Greenwich.
+          return QVariant::fromValue(dt.toString(Qt::ISODate));
 	}
 	
 	return QVariant();
