RED-8650 - Support more date formats #379
@ -48,7 +48,7 @@ public class DateConverter {
|
||||
|
||||
public String convertDate(Date date, String resultFormat) {
|
||||
|
||||
DateFormat resultDateFormat = new SimpleDateFormat(resultFormat, Locale.ENGLISH);
|
||||
DateFormat resultDateFormat = new SimpleDateFormat(resultFormat, Locale.UK);
|
||||
return resultDateFormat.format(date);
|
||||
}
|
||||
|
||||
@ -68,12 +68,12 @@ public class DateConverter {
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(Objects.requireNonNull(DateConverter.class.getResourceAsStream("/date_formats.txt"))))) {
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
builder.appendOptional(DateTimeFormatter.ofPattern(line.trim(), Locale.ENGLISH));
|
||||
builder.appendOptional(DateTimeFormatter.ofPattern(line.trim(), Locale.UK));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Error reading date format file: " + e.getMessage());
|
||||
}
|
||||
return builder.toFormatter().withResolverStyle(ResolverStyle.SMART).withLocale(Locale.ENGLISH);
|
||||
return builder.toFormatter().withResolverStyle(ResolverStyle.SMART).withLocale(Locale.UK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
dd-MMM-yyyy
|
||||
dd MMM yyyy
|
||||
dd MMM yy
|
||||
dd MM yyyy
|
||||
dd MMMM yyyy
|
||||
MMMM dd, yyyy
|
||||
dd-MMM-yyyy
|
||||
dd.MM.yyyy
|
||||
yyyy/MM/dd
|
||||
yyyy-MM-dd
|
||||
|
||||
@ -157,7 +157,7 @@ public class DocumineFloraTest extends AbstractRedactionIntegrationTest {
|
||||
String[] dateArray = dates.split(", ");
|
||||
boolean allEqual = true;
|
||||
for (String date : dateArray) {
|
||||
if (!"10/01/2022".equals(date)) {
|
||||
if (!"10/01/2022".equals(date) && !"08/09/2024".equals(date)) {
|
||||
allEqual = false;
|
||||
break;
|
||||
}
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user