Offer localDateMatcher FIX
This commit is contained in:
parent
8c7e62b502
commit
2b2bbf9182
@ -78,8 +78,12 @@ public class OfferCreate {
|
||||
|
||||
final Matcher localDateMatcher = Pattern.compile("(?<day>\\d+).(?<month>\\d+).(?<year>\\d+)").matcher(text);
|
||||
if (localDateMatcher.find()) {
|
||||
return ZonedDateTime.of(LocalDate.of(Integer.parseInt(localDateMatcher.group("day")), Integer.parseInt(localDateMatcher.group("month")), Integer.parseInt(localDateMatcher.group("year"))), LocalTime.MIDNIGHT, TimeZone.getDefault().toZoneId());
|
||||
final int day = Integer.parseInt(localDateMatcher.group("day"));
|
||||
final int month = Integer.parseInt(localDateMatcher.group("month"));
|
||||
final int year = Integer.parseInt(localDateMatcher.group("year"));
|
||||
return ZonedDateTime.of(LocalDate.of(year, month, day), LocalTime.MIDNIGHT, TimeZone.getDefault().toZoneId());
|
||||
}
|
||||
|
||||
throw new NumberFormatException("Failed to parse date: " + text);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user