Skip to content

Issue with validating DateTimeFormatter.ofPattern("ddMMyyyy") #60

@Istalan

Description

@Istalan

Hi,

I have been using your DatePicker with great sucess so far, but i've encountered an issue with adding DateTimeFormatters without symbols between the d's, M's and y's to the FormatsForParsing. The String does not get validated. I also added a few different Patterns and they work fine. I also looked at what happens if i use "ddMMyyyy" as FormatForDatesCommonEra on a DatePicker, that displays the current date and it displays it correctly but marks it as invalid (red Text).

My Code:

final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy");
final DatePickerSettings settings = new DatePickerSettings(Locale.GERMANY);
settings.setFormatForDatesCommonEra(formatter);
settings.setFormatForDatesBeforeCommonEra( DateTimeFormatter.ofPattern("d.M.yy.G"));
		
ArrayList parsingList = settings.getFormatsForParsing();
parsingList.add(DateTimeFormatter.ofPattern("d M yyyy"));
parsingList.add(DateTimeFormatter.ofPattern("d-M-yyyy"));
parsingList.add(DateTimeFormatter.ofPattern("ddMMyyyy"));
		
settings.setFormatsForParsing(parsingList);
//this part just as an example
DatePicker oneofmany = new DatePicker (settings.CopySettings());

I also checked, if the standard Code:
LocalDate date = LocalDate.parse( "02032017" ,DateTimeFormatter.ofPattern("ddMMyyyy"));
works and it does.

I hope i communicated the Problem clearly, since neither an experienced programmer nor a native speaker. Other than this i found your package easy to work with and was very happy with the helpfull Documentation.

Thanks for all your hard work, even if you don't get around to this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions