https://bugs.documentfoundation.org/show_bug.cgi?id=106956

            Bug ID: 106956
           Summary: Erroneous and inconsitant handling of ISO date format
                    in Basic functionsnco
           Product: LibreOffice
           Version: 5.2.3.3 release
          Hardware: x86 (IA32)
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: [email protected]
          Reporter: [email protected]

Description:
ISO 8601 allows two representations for a date: one without separators between
year and month (e.g. “20170403”) and month and day, the other with a hyphen as
separator (e.g. “2017-04-03”).
The handling of these representations in LibO Basic is inconsistent and even
erroneous in one case:
CDateFromIso handles the first representation correctly, whereas it yields a
wrong date when one uses the second one.
Example:
dim d1 as date, d2 as date, l1 as long, l2 as long
REM  the variables of type long are used to show the internal representation of
a date
l1 = CDateFromIso("20021231")
d1 = CDateFromIso("20021231")
l2 = CDateFromIso("2002-12-31")
d2 = CDateFromIso("2002-12-31")
msgbox l1 & "  " & d1 & "    " & l2 & "  " & d2
yields (in German date format):
37621  31.12.2002    37318  03.03.2002
The function should either handle both representations correctly or reject the
second representation, as it does with strings not matching the date acceptance
patterns for the locale.

CDate and DateValue, on the other hand, accept only the second representation
with hyphens, but reject the one without, putting out the error message
“Inadmissible value or data type. Data type mismatch.”.
As the representation without hyphens is the one used for the output of
CDateToIso, it should be accepted as input for these functions, as well.

Steps to Reproduce:
1. For CDateFromIso execute the example above.
2. For CDate and DateValue simply run the statement Datevalue("2002-12-31")
with and without hyphens; same for the other function.

Actual Results:  
see text above

Expected Results:
see text above


Reproducible: Always

User Profile Reset: No

Additional Info:
help text for the named date functions is outdated , I'll enter another bug
report to correct the documentation very soon.


User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
Firefox/52.0

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to