Change behaviour of converting OffsetDateTime to string in StringUtils
This commit is contained in:
parent
a159e76a62
commit
db658024d6
@ -4,8 +4,6 @@ import java.time.OffsetDateTime;
|
|||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
public class StringUtils {
|
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)
|
* 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
|
* @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
|
// to replace the DateFormat with java.time.format.DateTimeFormatter
|
||||||
if (o instanceof OffsetDateTime) {
|
if (o instanceof OffsetDateTime) {
|
||||||
OffsetDateTime odt = (OffsetDateTime)o;
|
OffsetDateTime odt = (OffsetDateTime)o;
|
||||||
return odt.format(DateTimeFormatter.ofPattern(DEFAULT_PATTERN));
|
return ParsingUtilities.dateToString((OffsetDateTime) odt);
|
||||||
} else if (o == null) {
|
} else if (o == null) {
|
||||||
return "";
|
return "";
|
||||||
} else {
|
} else {
|
||||||
@ -23,4 +21,3 @@ public class StringUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user