Download it now!
Bug 60915 - FORMATTING: Date with [~buddhist] always show the year with 4 digits
Summary: FORMATTING: Date with [~buddhist] always show the year with 4 digits
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.4.0 Beta1
Hardware: Other All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: BSA target:4.1.0 target:3.6.6 target:...
Keywords: regression
Depends on:
Blocks:
 
Reported: 2013-02-15 17:34 UTC by Korrawit Pruegsanusak
Modified: 2013-03-19 09:28 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
screenshot of Format Cells dialog (67.63 KB, image/png)
2013-02-15 17:34 UTC, Korrawit Pruegsanusak
Details
sample file (7.28 KB, application/vnd.oasis.opendocument.spreadsheet)
2013-02-15 17:43 UTC, Korrawit Pruegsanusak
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Korrawit Pruegsanusak 2013-02-15 17:34:45 UTC
Created attachment 74892 [details]
screenshot of Format Cells dialog

Problem description: 
Date formatting with "[~buddhist]" always show the year with 4 digits, regardless of format code "YY" or "YYYY"


Steps to reproduce:
1. New Spreadsheet
2. Type "01/01/2013" without quotes into A1 (or type any dates)
3. Right-click A1 > Format Cells...
4. Select Language "Thai", and Category "Date"
5. Select Format "31 ธ.ค. 2542", which has Format Code "[~buddhist]D MMM YY"
6. Click OK

Current behavior:
The date is formatted as "31 ธ.ค. 2542". The year is shown as 4 digits.

Expected behavior:
The date is formatted as "31 ธ.ค. 42". The year should be shown as 2 digits, regarding to format code "YY".

You can compare with the next format code "[~buddhist]D MMM YYYY". They both show same formatting, which should not.
Operating System: All
Version: 3.4.0 Beta1
Last worked in: 3.3.4 release
Comment 1 Korrawit Pruegsanusak 2013-02-15 17:43:05 UTC
Created attachment 74893 [details]
sample file

To reproduce using an attached sample file:

1. Open attached file
2. Notice that the cells A1 and A2 both show same result, which should not -- cell A1 should shown the year with only 2 digits. Cell A2 (4 digits year) is already correct.

3. Right-click at cell A1 > Format Cells ...
4. Notice that the format code is "[~buddhist]D MMM YY"

5. Right-click at cell A2 > Format Cells ...
6. Notice that the format code is "[~buddhist]D MMM YYYY"
Comment 2 Korrawit Pruegsanusak 2013-02-15 17:58:24 UTC
Hello Eike,

Unfortunately, I think this bug is caused by the fix for https://issues.apache.org/ooo/show_bug.cgi?id=116701, which is at http://cgit.freedesktop.org/libreoffice/core/commit/?id=4cdb854219094904e033428006fbaed6221d74b5

Could you please have a look at this bug? Thanks in advanced :)
Comment 3 Eike Rathke 2013-02-28 14:30:40 UTC
Thanks for the pointer, that indeed seems to be the cause.

Note: to reproduce the bug one has to either load the testcase file in a Thai locale or explicitly select a format from the Thai locale in the number formatter dialog, the formats applied in the file use the default locale, the [~buddhist] calendar has no effect if loaded in for example an en-US locale.
Comment 4 Not Assigned 2013-02-28 17:54:29 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=be16dba682b8ab1c244f8d24f1bab3a539096962

resolved fdo#60915 force long year only for ROC calendar



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.
Comment 5 Eike Rathke 2013-03-01 00:20:07 UTC
Change pending review
for 4-0 as https://gerrit.libreoffice.org/2474
for 3-6 as https://gerrit.libreoffice.org/2477
Comment 6 Korrawit Pruegsanusak 2013-03-01 10:49:30 UTC
Thanks for the fix :-)

Also, I'd like to make this into unit test [but still busy until after next weeks :( ] Anyway could you please give some code pointers? Thanks again.
Comment 7 Eike Rathke 2013-03-01 12:54:49 UTC
Yes, great! :-)
Such a test could be added to svl/qa/unit/svl.cxx

As the behavior depends on the Thai locale you'd need a SvNumberFormatter constructed with LANGUAGE_THAI, there are other means to switch a formatter's locale but that would be easiest.

You could also use a locale modifier for a single format in an English formatter as can be seen at around line 277 and use such a format, instead of the Excel notation I'd suggest our notation though, e.g. [$-41E][~buddhist]D/MM/YYYY
Comment 8 Not Assigned 2013-03-01 16:56:36 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-3-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=07b2b5ee619e123652bca2d18d4b61a94f94e00a&h=libreoffice-3-6

resolved fdo#60915 force long year only for ROC calendar


It will be available in LibreOffice 3.6.6.

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.
Comment 9 Not Assigned 2013-03-01 17:03:30 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-4-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=38fed1b25a1679ed4384ef0ed9ff4669f67a6723&h=libreoffice-4-0

resolved fdo#60915 force long year only for ROC calendar


It will be available in LibreOffice 4.0.2.

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.
Comment 10 Commit Notification 2013-03-19 09:28:20 UTC
Korrawit Pruegsanusak committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=0c4a20ad9ce9b3b9db8f4ad458bd742f84e1b903

unit test for fdo#60915



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.