Created attachment 172294 [details] docx with date fields I have a date-time field in a docx (created in MS Word 365) which is formatted with the string: TIME \@ "M/d/yyyy h:mm am/pm" \* MERGEFORMAT which displays correctly in Word as: (e.g.) 5/24/2021 1:55 PM When I open this document in LibreOffice (tested with 5.3.7.2 on Linux and 7.0.6.2 on Windows with the same outcome in each) the date-time displays as: (e.g.) 5/24/2021 13:55 a5/p5 This suggests that the am/pm marker from the MS format isn't being recognized as an instruction to use a 12hr clock and display the am/pm marker, but rather than it should use a 24hr clock and display the a and p as literal strings and interpret the "m" as a month marker. This behavior is also observed when running a command line "convert-to" odt. I have attached the original docx to enable re-production. This docx also demonstrates related date-time bugs for tickets: 136347 - (See Last Print Time in attached docx) 65209 - (When converting to ODT, TZ info is lost)
Reproduced in Version: 7.2.0.0.alpha1+ / LibreOffice Community Build ID: 42d2b2d55a27f11153ea1713737d93540a19211d CPU threads: 4; OS: Linux 5.7; UI render: default; VCL: gtk3 Locale: en-US (en_US.UTF-8); UI: en-US Calc: threaded Version: 5.2.0.0.alpha0+ Build ID: 3ca42d8d51174010d5e8a32b96e9b4c0b3730a53 Threads 4; Ver: 5.7; Render: default; and Version 4.1.0.0.alpha0+ (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a)
Created attachment 172295 [details] Screenshoot This is what I see, I think no issue.
Sorry to quick, reproducible on the last line.
It *seems* that a string like "am\\/pm" is not matched against a keyword "AM/PM", because of the backslash? It seems to happen in ImpSvNumberformatScan::GetKeyWord. No idea if it's safe to strip backslashes from strings at any of the stages up to the keyword detection...
https://gerrit.libreoffice.org/c/core/+/118369
Mike Kaganski committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/cd0ab69d4afee0c77884ae17ab9410216695b58b tdf#142464: do not escape '/' is AM/PM when importing DOCX. It will be available in 7.3.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.
FTR - was repro also in OOo 3.1.1.
Mike Kaganski committed a patch related to this issue. It has been pushed to "libreoffice-7-2": https://git.libreoffice.org/core/commit/f51f0c023dc163e348e784fc1f846a76afb9bf80 tdf#142464: do not escape '/' is AM/PM when importing DOCX. It will be available in 7.2.0.0.beta2. 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.
Verified. Working well in Version: 7.3.0.0.alpha0+ / LibreOffice Community Build ID: eac5977bfc11797eda356560a5e45c51108ef5a1 CPU threads: 4; OS: Linux 5.8; UI render: default; VCL: gtk3 Locale: ro-RO (ro_RO.UTF-8); UI: en-US Calc: threaded AM/PM instead of A7/P7