Change behaviour of converting OffsetDateTime to string in StringUtils

This commit is contained in:
Owen Stephens 2018-06-22 23:17:12 +01:00
parent a159e76a62
commit db658024d6

View File

@ -4,8 +4,6 @@ import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
public class StringUtils {
private static String DEFAULT_PATTERN = "dd-MMM-yyyy";
/**
* String formatting method that knows how to format dates (using the default locale's date formatter)
* @param o object to be converted to a string
@ -15,7 +13,7 @@ public class StringUtils {
// to replace the DateFormat with java.time.format.DateTimeFormatter
if (o instanceof OffsetDateTime) {
OffsetDateTime odt = (OffsetDateTime)o;
return odt.format(DateTimeFormatter.ofPattern(DEFAULT_PATTERN));
return ParsingUtilities.dateToString((OffsetDateTime) odt);
} else if (o == null) {
return "";
} else {
@ -23,4 +21,3 @@ public class StringUtils {
}
}
}