You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2011/03/14 14:04:22 UTC

DO NOT REPLY [Bug 50841] DataFormatter, DateUtil, and ExcelStyleDateFormatter issues

https://issues.apache.org/bugzilla/show_bug.cgi?id=50841

--- Comment #2 from Yegor Kozlov <ye...@dinom.ru> 2011-03-14 09:04:18 EDT ---
I'm reviewing your patch. My plan is to create a subclass of DataFormatter and
encapsulate CSV-specific logic in it. NcoDataFormatter should share common
stuff, not duplicate it. 

Fixes in date detection and formatting (items 8 - 11 from differences.txt) seem
to be generic and I'm going to apply them directly to DateUtil and
ExcelStyleDateFormatter. 

To support elapsed time you proposed to change 

    Pattern date_ptrn2 = Pattern.compile("^\\[[a-zA-Z]+\\]");
    to
    Pattern date_ptrn2 = Pattern.compile("^\\[[A-Z]+\\]");

(item 8 from differences.txt).

This "loosened" regex will skip formats with a prefixed color, e.g.
[yellow]yyyy-mm-dd or [red][hh] 

I'm going to define a fourth regexp for the elapsed time patterns:

    //  elapsed time patterns: [h],[m] and [s]
    private static final Pattern date_ptrn4 =
Pattern.compile("^\\[([hH]+|[mM]+|[sS]+)\\]");

and use it in combination with date_ptrn2. 

Other than that, very cool! Thank you for the patch.

Yegor

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org