Bug 154217 - Fields variables (user field and variable) cannot format value for update as date (or similar)
Summary: Fields variables (user field and variable) cannot format value for update as ...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: target:7.6.0
Keywords:
Depends on:
Blocks: Fields-Variable
  Show dependency treegraph
 
Reported: 2023-03-15 21:37 UTC by Peter Gervai
Modified: 2023-04-29 14:36 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Gervai 2023-03-15 21:37:37 UTC
Fields >> Variables >> User Field, Set variable, Show Variable, and editing a field or a variable by double click cannot handle formatting other than text or numerical, causing a very confusing experience, especially for dates and datetime.

Reproduction:
1. create a new variable with "Set variable", and set format to a date format like "1999-01-01", and enter a date value, say, 2023-03-15.
2. Insert the variable, and close the dialog.
3. Double-click on the field: you will get value "42000"

I see that it's "number of dates since 1899-12-30", but that probably won't help much in everyday use. 

It seems user fields and variables remember their formatting, but the input field ignores that when displaying. It is still possible to correctly update the field with "2022-11-22", but it's not possible to view the actual value.

(As a sidenote: the manual about variables and user fields is pretty terse. It  even neglects to tell the difference between variables and user fields. I see now but... possibly I shall create some diff there.)
Comment 1 Dieter 2023-03-31 18:41:51 UTC
I confirm described behaviour with

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: b5c3a7502f7ff6ccf0f829c1f3a2ba50b8584c41
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-US (de_DE); UI: en-GB
Calc: CL threaded

but I'm afraid, this might be expected behaviour, see bug 130072. But I agree, that it is not really userfriendly.

Only could find following help page: https://help.libreoffice.org/7.6/en-GB/text/swriter/01/04090005.html?System=WIN&DbPAR=WRITER&HID=modules/swriter/ui/fldvarpage/FieldVarPage#bm_@@nowidget@@

Mike, after reading (without understanding) your comment 6 in bug 84144, I'm sure, that you can answer, if current behaviour is correct or not.
Comment 2 Eike Rathke 2023-04-02 13:30:54 UTC
The behaviour is correct, but not user-friendly.. for date+time displaying a formatted value would be better.
Comment 3 Commit Notification 2023-04-09 22:57:37 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/185cf4496d8750c9e4905c4e384252b01b85d130

Resolves: tdf#154217 Edit date+time User Field and Set Variable

It will be available in 7.6.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 4 Dieter 2023-04-29 14:36:02 UTC
VERIFIED with

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 006b35d50024b1932d84380b5d2fec1f7066bccd
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-US (de_DE); UI: en-GB
Calc: CL threaded

Eike, thank you for fixing it!