Bug 168252 - Writer mail merge letter adds 2 days to the dates of the calc-spreadsheet datasource
Summary: Writer mail merge letter adds 2 days to the dates of the calc-spreadsheet dat...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
25.8.1.1 release
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:26.2.0 target:25.8.2
Keywords: bibisected, bisected, regression
: 168343 (view as bug list)
Depends on:
Blocks: Mail-Merge
  Show dependency treegraph
 
Reported: 2025-09-02 14:40 UTC by UweBress
Modified: 2025-09-11 07:24 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
A screenshot of the Writer mail merge letter and the corresponding Calc-spreadsheet datasource (33.38 KB, image/png)
2025-09-02 14:43 UTC, UweBress
Details

Note You need to log in before you can comment on or make changes to this bug.
Description UweBress 2025-09-02 14:40:19 UTC
Description:
Since I upgraded to Libre Office 25.8 my mail merge letter adds 2 days to the dates of my calc-spreadsheet datasource.
I use this mail merge letter since 2016, didn't change anything and it never has been a problem in previous versions of Libre Office.


Steps to Reproduce:
1. Create a Calc spreadsheet with dates.
2. Create a Writer mail merge letter which uses the dates of Calc spreadsheet as datasource.

Actual Results:
The dates in the Writer letter are the dates of the Calc spreadsheet + 2 days.

Expected Results:
The dates in the Writer mail merge letter should be the same as the dates of the Calc spreadsheet.


Reproducible: Always


User Profile Reset: No

Additional Info:
None
Comment 1 UweBress 2025-09-02 14:43:11 UTC
Created attachment 202663 [details]
A screenshot of the Writer mail merge letter and the corresponding Calc-spreadsheet datasource
Comment 2 Alex Thurgood 2025-09-02 15:12:44 UTC
Under Tools > Options > LibreOffice Calc > Date, which option is ticked ?
Comment 3 UweBress 2025-09-02 15:22:20 UTC
Under Tools > Options > LibreOffice Calc > Date the standard option 30.12.1899 is ticked.
Comment 4 Alex Thurgood 2025-09-02 18:03:06 UTC
There was some work done on the default date recently, but I can't find the commit in question.
Comment 5 UweBress 2025-09-02 20:34:35 UTC
When I revert back to Libre Office Version 25.2.5.2 (X86_64) with all settings of the Writer mail merge document and the corresponding Calc spreadsheet datasource unchanged (standard date option 30.12.1899) the bug is not there any more.
So I stay with Libre Office 25.2 until the problem is solved.
Comment 6 m_a_riosv 2025-09-03 23:12:28 UTC
@Alex maybe tdf#167591
Comment 7 Robert Großkopf 2025-09-06 06:28:06 UTC
Tested width a new Calc document.
Date will be shown right in database browser.
When printing the mail merge letter it will be set date+2days.

This bug appears in
Version: 25.8.1.1 (X86_64)
Build ID: 54047653041915e595ad4e45cccea684809c77b5
CPU threads: 6; OS: Linux 6.4; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Calc: threaded

The bug won't appear in
Version: 25.8.0.4 (X86_64)
Build ID: 48f00303701489684e67c38c28aff00cd5929e67
CPU threads: 6; OS: Linux 6.4; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Calc: threaded
Comment 8 BogdanB 2025-09-06 06:34:20 UTC
If was caused by the bug https://bugs.documentfoundation.org/show_bug.cgi?id=167591 than we could say we know the cause.
Comment 9 BogdanB 2025-09-06 06:35:14 UTC
Mike, can you please take a look on this bug?
Comment 10 Saburo 2025-09-06 08:12:19 UTC
bibisected with linux-64-26.2 0bb13f8cda7e461a8f3a84fad162c741abf8a37c is the first bad commit
    source 5b808448dc79e996efa7cb5082145d4e5803daa6

commit 5b808448dc79e996efa7cb5082145d4e5803daa6	[log]
author	Mike Kaganski <mike.kaganski@collabora.com>	Sun Jul 20 23:27:26 2025 +0500
committer	Mike Kaganski <mike.kaganski@collabora.com>	Mon Jul 21 08:18:18 2025 +0200
tree 08dff70cde07aaffd25517fd7d59fc20f1f0d235
parent 060775489a42d5489417b8a5c29c8f0b4006f796 [diff]

Related: tdf#167591 Make STANDARD_DB_DATE more standard

For some reason, STANDARD_DB_DATE was 1900-01-01, which differs from
the most used epoch of 1899-12-30 (see e.g. the default initializer
of ImpSvNumberformatScan). This was triggering tdf#167591, where the
correction added two days of the difference to the date entered into
the default value box.

I couldn't find how/if this value could get exposed to API; so let's
try to standardise it a bit.

Change-Id: I9207cbe3a5a91ca63f3f97792da0c5ad2931ffa8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188092
Comment 11 Mike Kaganski 2025-09-10 10:45:57 UTC
https://gerrit.libreoffice.org/c/core/+/190749
Comment 12 BogdanB 2025-09-10 10:48:06 UTC
*** Bug 168343 has been marked as a duplicate of this bug. ***
Comment 13 Commit Notification 2025-09-10 17:41:10 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/92f0eeef847bb8c980aef1760c3355df0e2e11ef

tdf#168252: fix "standard" date in SwDBField::FormatValue

It will be available in 26.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Commit Notification 2025-09-11 07:24:34 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-25-8":

https://git.libreoffice.org/core/commit/8eeb11aba618d6333b254b05749bba9d6235827f

tdf#168252: fix "standard" date in SwDBField::FormatValue

It will be available in 25.8.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.