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
Reproduced. Win 7 Pro 64-bit Version: 5.4.0.0.alpha0+ (x64) Build ID: 1f73ac90da31b62ccf6f040c68e5c0150171240f CPU threads: 4; OS: Windows 6.1; UI render: default; TinderBox: Win-x86_64@42, Branch:master, Time: 2017-04-20_07:32:30 Locale: fi-FI (fi_FI); Calc: CL
Taking.
Eike Rathke committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=cdcbdf88b7f74184b532925eaf140dbf65a2cd21 Resolves: tdf#106956 CDateFromIso accept also YYYY-MM-DD form It will be available in 5.4.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Eike Rathke committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=af754ef9d6655a7b76a39f5a2c5bef8290fc3163 Add unit test for CDateFromIso with YYYY-MM-DD, tdf#106956 It will be available in 5.4.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Eike Rathke committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=d6fd4252bf248d2872c713a1d83817a2dc88a9d2 Use invalid parameter error for malformed input, tdf#106956 follow-up It will be available in 5.4.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Pending review https://gerrit.libreoffice.org/37074 for 5-3
Eike Rathke committed a patch related to this issue. It has been pushed to "libreoffice-5-3": http://cgit.freedesktop.org/libreoffice/core/commit/?id=039705ec1a215ff83ea707e5fc642d0e63f6b48d&h=libreoffice-5-3 Resolves: tdf#106956 CDateFromIso accept also YYYY-MM-DD form It will be available in 5.3.4. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Eike Rathke committed a patch related to this issue. It has been pushed to "libreoffice-5-3": http://cgit.freedesktop.org/libreoffice/core/commit/?id=134dd332ceaeab43c022cdf3585ca5432cdaa77a&h=libreoffice-5-3 CDateFromIso: accept YYMMDD for compatibility, tdf#106956 follow-up It will be available in 5.3.4. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.