Revision history [back]

click to hide/show revision 1
initial version

asked 2018-12-14 19:29:36 +0800

gooamoko gravatar image gooamoko

Bug in Datebox with lenient=false and value 01.04.1981?

Hi all. I have this simple Dialog for date input

public DateDialog(Component parentComponent, String title) {
    super();
    Caption dialogCaption = new Caption(title);
    setWidth("600px");
    setHeight("400px");
    setSclass("dialog");
    setSizable(false);
    setClosable(false);
    setStyle("padding: 10px 10px;");
    setParent(parentComponent);

    Label dateLabel = new Label("Input date");
    dateLabel.setHflex("1");
    dateBox = new Datebox();
    dateBox.setFormat("dd.MM.yyyy");
    dateBox.setLenient(false);
    dateBox.setHflex("1");
    dateBox.addEventListener(Events.ON_CHANGE, (SerializableEventListener<Event>) event -> {
        String errorMessage = dateBox.getErrorMessage();
        if (errorMessage != null && !errorMessage.trim().isEmpty()) {
            Messagebox.show("Incorrect date:\n" + errorMessage, "Error", Messagebox.OK, Messagebox.ERROR);
        }
    });

    Hlayout dateLayout = new Hlayout();
    dateLayout.appendChild(dateLabel);
    dateLayout.appendChild(dateBox);

    clientLayout = new Vlayout();
    clientLayout.appendChild(dateLayout);

    mainLayout = new Vlayout();
    appendChild(dialogCaption);
    appendChild(mainLayout);
    mainLayout.appendChild(getVSplitter());
    mainLayout.appendChild(clientLayout);
    mainLayout.appendChild(getVSplitter());
    initButtons();
}

When I input in Datebox values

  • 01.04.1981
  • 01.04.1982
  • 01.04.1983
  • 01.04.1984

I get an error of incorrect format. But why 01.04.1981 is incorrect? All other dates are correct. What is it?

Bug in Datebox with lenient=false and value 01.04.1981?

Hi all. I have this simple Dialog for date input

public DateDialog(Component parentComponent, String title) {
    super();
    Caption dialogCaption = new Caption(title);
    setWidth("600px");
    setHeight("400px");
    setSclass("dialog");
    setSizable(false);
    setClosable(false);
    setStyle("padding: 10px 10px;");
    setParent(parentComponent);

    Label dateLabel = new Label("Input date");
    dateLabel.setHflex("1");
    dateBox = new Datebox();
    dateBox.setFormat("dd.MM.yyyy");
    dateBox.setLenient(false);
    dateBox.setHflex("1");
    dateBox.addEventListener(Events.ON_CHANGE, (SerializableEventListener<Event>) event -> {
        String errorMessage = dateBox.getErrorMessage();
        if (errorMessage != null && !errorMessage.trim().isEmpty()) {
            Messagebox.show("Incorrect date:\n" + errorMessage, "Error", Messagebox.OK, Messagebox.ERROR);
        }
    });

    Hlayout dateLayout = new Hlayout();
    dateLayout.appendChild(dateLabel);
    dateLayout.appendChild(dateBox);

    clientLayout = new Vlayout();
    clientLayout.appendChild(dateLayout);

    mainLayout = new Vlayout();
    appendChild(dialogCaption);
    appendChild(mainLayout);
    mainLayout.appendChild(getVSplitter());
    mainLayout.appendChild(clientLayout);
    mainLayout.appendChild(getVSplitter());
    initButtons();
}

When I input in Datebox values

  • 01.04.1981
  • 01.04.1982
  • 01.04.1983
  • 01.04.1984

I get an error of incorrect format. But why 01.04.1981 is incorrect? All other dates are correct. What is it?it? If setLenient(true), then there is no error.

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More