Document drawbacks to leniency w/ SimpleDateFormat & DateTimeFormatter

master
Sam Brannen 1 year ago
parent
commit
76b0e88a0f
  1. 2
      Date-and-Time-Formatting-with-JDK-20-and-higher.md

2
Date-and-Time-Formatting-with-JDK-20-and-higher.md

@ -60,6 +60,8 @@ pubic static DateTimeFormatter createLenientDateTimeFormatter( @@ -60,6 +60,8 @@ pubic static DateTimeFormatter createLenientDateTimeFormatter(
}
```
Please note, however, that lenient parsing in `DateTimeFormatter` instances and especially in `SimpleDateFormat` may be more _lenient_ that you need or desire. For example, you may find that parsing succeeds for input which is technically invalid, such as `Feb 29` for a non-leap-year. In light of that, be cautious when configuring lenient parsing for `SimpleDateFormat` and `DateTimeFormatter`, and be sure to verify that your application continues to work properly.
## Resources
- https://openjdk.org/jeps/252

Loading…
Cancel
Save