Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

vlsi
Copy link
Owner

@vlsi vlsi commented Aug 18, 2017

Add more patterns to automatic format detector, pick a format that produces maximum date

fixes #103

@vlsi vlsi requested a review from Pitterling August 18, 2017 15:12
Add more patterns to automatic format detector, pick a format that produces maximum date

fixes #103
@Pitterling
Copy link
Collaborator

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 {
Copy link
Collaborator

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;
Copy link
Collaborator

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"

Copy link
Collaborator

@Pitterling Pitterling left a 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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DD/MM/YY 12:59:59 format
2 participants