I'm using
MessageFormat.format("Hello {0}", "World"));
Now I want to use LocalDate or LocalDateTime as parameters but as far as I can see MessageFormat.format doesn't support java.time!
So I have to use
MessageFormat.format("Today is {0,date}",
Date.from(LocalDate.now().atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()));
This is terrible!
Is there a better way to use MessageFormat with java.time? Or are there better solutions to replace placeholders in a text that considers Locale configuration?
Update
I'm aware of how to format LocalDate and LocalDateTime but I have the requirement to format a message with various types.
Example
MessageFormat.format("Today is {0,date} {1,number} {2}", aDate, aNumber, aString);
Where is the replacement for MessageFormat with java.time Types?