Reports date format patterns that are likely used by mistake.
Usages of the following patterns are reported:
- Uppercase "Y", unless "w" appears nearby because it's a "Week year" that almost always
the same as normal "Year" (lowercase "y" pattern), but may point to the next year
at the end of December.
- Uppercase "M" (month) close to "H", "K", "h", or "k" (hour). It's likely that a lowercase "m" (minute) was intended
- Lowercase "m" (minute) close to "y" (year) or "d" (day in month). It's likely that an uppercase "M" (month) was intended
- Uppercase "D" (day in year) close to "M", or "L" (month). It's likely that a lowercase "d" (day in month) was intended
- Uppercase "S" (milliseconds) close to "m" (minutes). It's likely that a lowercase "s" (seconds) was intended
Examples:
new SimpleDateFormat("YYYY-MM-dd")
: likely "yyyy-MM-dd"
was intended.
new SimpleDateFormat("yyyy-MM-DD")
: likely "yyyy-MM-dd"
was intended.
new SimpleDateFormat("HH:MM")
: likely "HH:mm"
was intended.
New in 2020.1