-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: improve automatic format detection #106
base: master
Are you sure you want to change the base?
Conversation
Add more patterns to automatic format detector, pick a format that produces maximum date fixes #103
2340c61
to
cbec464
Compare
will do the review over the weekend. @elkrieg please also have a look and share your thoughts |
DateTimeFormatter best = null; | ||
LocalDate bestDate = null; | ||
for (DateTimeFormatter format : DATE_FORMATS) { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logging would be great .. log.Trace "found valid .."
try { | ||
LocalDate nextDate = LocalDate.parse(dateString, format); | ||
if (bestDate == null || nextDate.compareTo(bestDate) >= 0) { | ||
bestDate = nextDate; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also here .. log.trace "found better date"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in general its ok, but it only works with the assumption that you look only to recent files. What if i look the older files for comparison reason ..
We could also offer the possible formats in an optional box ?? Or provide 2 options a) automatic detection choose best .. and b) automatic detection - ask ?
Add more patterns to automatic format detector, pick a format that produces maximum date
fixes #103