In 7.0.244, the new support for setting the datePicker.setDefaultDate() has created a side-effect:
Run the code below, the picker will show "..." (no value set), tap the picker, it will show current time (the expected default value), then click Cancel and the displayed picker time will incorrectly be current time (where it should still be "..."). Clicking the button "Print Picker GetDate()" confirms the Picker returns the default value despite the Cancel.
This only happens on the initial use. If you click the picker a second time, update the value, and then tap Cancel, the old value is kept as expected.
Form form = new Form("Test Picker", new BoxLayout(BoxLayout.Y_AXIS));
Picker datePicker = new Picker();
datePicker.setDefaultDate(()->new Date());
datePicker.setType(Display.PICKER_TYPE_DATE);
datePicker.setDate(null);
form.add(datePicker);
Button but = new Button(Command.createMaterial("Print Picker GetDate()", FontImage.MATERIAL_FLASH_ON,
e -> Log.p(datePicker.getDate().toString())));
form.add(but);
form.show();
In 7.0.244, the new support for setting the
datePicker.setDefaultDate()has created a side-effect:Run the code below, the picker will show "..." (no value set), tap the picker, it will show current time (the expected default value), then click Cancel and the displayed picker time will incorrectly be current time (where it should still be "..."). Clicking the button "Print Picker GetDate()" confirms the Picker returns the default value despite the Cancel.
This only happens on the initial use. If you click the picker a second time, update the value, and then tap Cancel, the old value is kept as expected.