public DatePickerPlugin(final IPluginContext context, final IPluginConfig config) { super(context, config); final IModel<Date> model = new MapEmptyDateToNullModel(getModel()); final Mode mode = Mode.fromConfig(config, Mode.VIEW); if (mode == Mode.EDIT) { add(new DateFieldWidget(VALUE, model, context, config)); } else { final boolean dateOnly = config.getAsBoolean(DateFieldWidget.CONFIG_HIDE_TIME, false); if (dateOnly) { add(new DateLabel(VALUE, model, FormatStyle.LONG)); } else { add(new DateTimeLabel(VALUE, model, FormatStyle.LONG, FormatStyle.SHORT)); } } setOutputMarkupId(true); } }