ICU4C SimpleDateFormat operator= and operator== need updating
SimpleDateFormat operator= and operator== need updating to handle TimeZoneFormat* fTimeZoneFormat and the number format overrides. Without these updates, SimpleDateFormat clones (and udat_clone) do not work correctly in many instances.
1. TimeZoneFormat* fTimeZoneFormat; this used to be just set from the locale, but now there are setters that can set it independently. For operator==, the big sequence of AND clauses needs to add:
and in operator= we need to change
2. The number format overrides. For operator== we can just compare the override strings, since the override number formatters derive from them:
For operator=, we need to copy the override strings, then delete everything in fNumberFormatters and fOverrideList (as in ~SimpleDateFormat), and regenerate them by calling initNumberFormatters
Campion Loong fixed the operator= issue in ICU 67 with the referenced PR-963, and filed for the remaining operator== issue (Thanks !). So this ticket can be closed.
Hi Peter, I am running into the SimpleDateFormat::operator= bug in codes I maintain in our organization (The MathWorks). I patched that locally and realized it is mentioned in this ticket. My patch basically did the same thing as you suggested for operator=, but does not involving changing SimpleDateFormat::operator== or the number format overrides.
I’m working to port the SimpleDateFormat::operator= patch back into ICU’s GitHub project. It has passed through various build and test layers in our organization. I plan to attach that to this ticket although it’s only addressing part of this. I am new the the project - please advise if it should be tracked otherwise.
Trac Comment 10 by —2016-03-01T01:08:00.535Z
Ran out of time to do this for ICU 57 (code freeze was yesterday), moving to 58, sigh
Trac Comment 9 by —2016-03-01T01:06:00.053Z
Ran out of time to do this for ICU 57
Trac Comment 5 by —2014-12-05T18:56:27.078Z
I think the equivalent of much or all of this may have been done under #11139, need to check