Bug 115528 - Datetime2 extension gives error in LO 6.0.0.3 (locale-dependent)
Summary: Datetime2 extension gives error in LO 6.0.0.3 (locale-dependent)
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.0.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Number-Format
  Show dependency treegraph
 
Reported: 2018-02-07 20:57 UTC by VLB
Modified: 2019-08-16 17:18 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Error message (182.86 KB, image/jpeg)
2018-02-07 20:57 UTC, VLB
Details

Note You need to log in before you can comment on or make changes to this bug.
Description VLB 2018-02-07 20:57:12 UTC
Created attachment 139675 [details]
Error message

Windows 10 64 bit LO 6.0.0.3

I used extension Datetime2 a long time in LO, but in LO 6 i can't use the extension.
Comment 1 Xavier Van Wijmeersch 2018-02-08 10:16:09 UTC
with so less info i only can say use timeStampBackup_v1-1-6.oxt
its works for in LO master and LO 6.0
Comment 2 Xisco Faulí 2018-02-08 16:15:59 UTC
Thank you for reporting the bug.
Unfortunately without clear steps to reproduce it, we cannot track down the origin of the problem.
Please provide a clearer set of step-by-step instructions on how to reproduce the problem.
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the steps are provided
Comment 3 VLB 2018-02-08 17:45:54 UTC
Here by the steps to reproduce:

1) download https://github.com/komma4/DateTime2/blob/master/DateTime2.oxt
2) instal DateTime2.oxt with extension manager
3) choose a cell to make a date field
4) choose run macro by extention "DateTime2/DateTime2" unther my library
5) choose macro name "Datum_Feld" on the right
6) choose run and there is a error
Comment 4 Buovjaga 2018-03-04 17:51:59 UTC
The message:
BASIC runtime error.
An exception occurred 
Type: com.sun.star.uno.RuntimeException
Message: .

The line with the error:
nDateTime_Format_TIME = _

in this block:
' Schluesselwert nicht gefunden: hinzufuegen Format
' format not found - key not returned: add format
If nDateTime_Format_TIME < 0 Then
 nDateTime_Format_TIME = _
 oFormats.addNew( MYTIMEFORMAT, aLocale )
End If

Let's set to NEW and maybe some macro guru can tell what is going on. Bibisecting is also a solution.

Arch Linux 64-bit
Version: 6.1.0.0.alpha0+
Build ID: 13164cc99dc6184fb2c12e56e9c0dea0d5692eec
CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group
Built on March 4th 2018
Comment 5 Xisco Faulí 2018-03-05 17:44:02 UTC
I can't reproduce it in

Version: 6.1.0.0.alpha0+
Build ID: 2affed9bfd72628549df3049ed9f6e6a30fdb5b8
CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group

Could it be related to the locale and the locale's format?
Comment 6 Buovjaga 2018-03-05 17:52:38 UTC
(In reply to Xisco Faulí from comment #5)
> I can't reproduce it in
> 
> Version: 6.1.0.0.alpha0+
> Build ID: 2affed9bfd72628549df3049ed9f6e6a30fdb5b8
> CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk3; 
> Locale: ca-ES (ca_ES.UTF-8); Calc: group
> 
> Could it be related to the locale and the locale's format?

Yep, it works with Catalan locale. vlb can try Tools - Options - Language settings - Languages
Comment 7 VLB 2018-03-05 18:07:42 UTC
> Yep, it works with Catalan locale. vlb can try Tools - Options - Language
> settings - Languages

Yep, it works with a other locale lanquage setting...
Is this solve the problem?
Comment 8 Buovjaga 2018-03-05 18:24:38 UTC
(In reply to vlb from comment #7)
> > Yep, it works with Catalan locale. vlb can try Tools - Options - Language
> > settings - Languages
> 
> Yep, it works with a other locale lanquage setting...
> Is this solve the problem?

Well Xisco can bisect it with Finnish locale to find out what change made it break.
It is a bit of a problem, though, that the extension does not seem actively developed. I recommend to try and contact the author in any case.
Comment 9 VLB 2018-03-05 18:28:19 UTC
(In reply to Buovjaga from comment #8)
> (In reply to vlb from comment #7)
> > > Yep, it works with Catalan locale. vlb can try Tools - Options - Language
> > > settings - Languages
> > 
> > Yep, it works with a other locale lanquage setting...
> > Is this solve the problem?
> 
> Well Xisco can bisect it with Finnish locale to find out what change made it
> break.
> It is a bit of a problem, though, that the extension does not seem actively
> developed. I recommend to try and contact the author in any case.

Also the locale Dutch didn't work.
Comment 10 Aron Budea 2018-03-15 05:44:28 UTC
Bibisected to the commit referenced below using repo bibisect-win32-6.0. This seems to be a fallout from bug 33689 fix.
Adding Cc: to Laurent BP, please take a look. Eike, also CCing you, since you worked on another similar regression before (bug 114185).

https://cgit.freedesktop.org/libreoffice/core/commit/?id=80c0a7300b9e185cd77f754abbad31422826662c
author		Laurent BP <laurent.balland-poirier@laposte.net>	2017-10-08 20:05:34 +0200
committer	Eike Rathke <erack@redhat.com>	2017-10-19 22:13:44 +0200

tdf#33689 Accept English syntax keywords in format strings
Comment 11 Laurent Balland 2018-03-15 09:17:49 UTC
I cannot reproduce with:
- Version: 6.0.2.1 (x64)
Build ID: f7f06a8f319e4b62f9bc5095aa112a65d2f3ac89
Threads CPU : 2; OS : Windows 6.1; UI Render : par défaut; 
Locale : de-DE (fr_FR); Calc: CL

My detailed procedure:
1. Install extension https://github.com/komma4/DateTime2/blob/master/DateTime2.oxt and restart
2. Set German locale as it seems this macro works *only* for this locale (if you use a different locale, you need to modify the code inside the macro as explained in the description of the extension): Tools>Options> Language Settings> Language> Locale setting = German (Germany)
3. Create a new spreadsheet
4. Tools > Macros > Run Macro > LibreOffice Macros > DateTime2 > DateTime2
5. Select Datum_Feld macro and click Run button

Actual behavior:
date is formatted YYYY-MM-DD (JJJJ-MM-TT with de locale)
I don't know if it is the expected behavior but I got no error message.

If I use a different locale than German, then the behavior will depend on version and locale:
- With LibO6.0 there is an error message
- With previous version, LibO try to apply JJJJ-MM-TT number format in the locale setting, and transform in text what is not recognized. For instance in Dutch J is year, but T means nothing, so format will result in YYYY-MM-"TT"

From my point of view there is an enhancement to warn user that macro does not work as expected.
Comment 12 Eike Rathke 2018-03-15 16:28:25 UTC
With 6.0.2.1 in an en-US locale I do not even get the mentioned error with the default "JJJJ-MM-TT" format, just the date is displayed as JJJJ-03-TT, which is logical. In an nl-NL locale I get the error. This is because MYTIMEFORMAT is "HH:MM" but in nl-NL should be "UU:MM". It works well if date format codes are set to "DD-MM-JJJJ" or "JJJJ-MM-DD" and time format codes set to "UU:MM" to match the nl-NL locale.

Original submitter should
a) in the macro module DateTime2_func change the MYDATEFORMAT,
   MYTIMEFORMAT and MYTIMESTAMPFORMAT to proper format codes matching
   the current work locale, as the extension explains; for nl-NL that
   would be the DD-MM-JJJJ or JJJJ-MM-DD date format and UU:MM time
   format
b) at least in Calc maybe rather use the Ctrl+; and Shift+Ctrl+;
   shortcuts to insert date and time values (note that for other UI
   languages' keyboards the shortcuts may differ)

Not sure at the moment why HH:MM is not accepted instead of UU:MM or if it really should, it is accepted in the UI number formatter dialog and properly converted to UU:MM
Comment 13 VLB 2018-03-15 17:31:01 UTC
(In reply to Eike Rathke from comment #12)
> Original submitter should
> a) in the macro module DateTime2_func change the MYDATEFORMAT,
>    MYTIMEFORMAT and MYTIMESTAMPFORMAT to proper format codes matching
>    the current work locale, as the extension explains; for nl-NL that
>    would be the DD-MM-JJJJ or JJJJ-MM-DD date format and UU:MM time
>    format

I have change the func and it works now!
Thanks for help here to solve it.
Comment 14 Laurent Balland 2019-08-16 17:18:04 UTC
(In reply to vlb from comment #13)
> I have change the func and it works now!
> Thanks for help here to solve it.
As it seems solved, I close this report. Feel free to reopen it if necessary.