Search before asking
Motivation
DateUtils mixes date parsing/formatting with format-string date detection. To improve readability and reduce complexity, I suggest refactoring it to follow SRP.
Solution
Extract format detection into ExcelDateFormatDetector(package-private). Move isADateFormat, isADateFormatUncached, isInternalDateFormat, and their regex/cache internals into a new class.
DateUtils keeps the same three public methods, now one-line delegations - no API change, no behaviour change.
Example:
public static boolean isADateFormat(Short formatIndex, String formatString) {
return ExcelDateFormatDetector.isADateFormat(formatIndex, formatString);
}
public static void removeThreadLocalCache() {
DATE_FORMAT_THREAD_LOCAL.remove();
DATE_TIME_FORMATTER_THREAD_LOCAL.remove();
ExcelDateFormatDetector.removeThreadLocalCache();
}
Alternatives
No response
Anything else?
No response
Are you willing to submit a PR?
Search before asking
Motivation
DateUtilsmixes date parsing/formatting with format-string date detection. To improve readability and reduce complexity, I suggest refactoring it to follow SRP.Solution
Extract format detection into
ExcelDateFormatDetector(package-private). MoveisADateFormat,isADateFormatUncached,isInternalDateFormat, and their regex/cache internals into a new class.DateUtils keeps the same three public methods, now one-line delegations - no API change, no behaviour change.
Example:
Alternatives
No response
Anything else?
No response
Are you willing to submit a PR?