DateTime elements

A DateTimeFormElement writes an <input> element type="text" with the right classes to the output. To represent a date/time picker it uses the Eonasdan datetimepicker JQuery plugin. See DateTimeFormElementConfiguration for configuration options.

Element and builder

The DateTimeFormElement has an equivalent DateTimeFormElementBuilder. A builder can be created using BootstrapViewElements.bootstrap.builders.datetime() factory methods.

DateTimeFormElement attributes

Attribute Description Default

value

A Date, LocalDate, LocalTime, LocalDateTime or null value can be provided

Null be default

configuration

A DateTimeFormElementConfiguration can be provided

Null be default

format

Requires a DateTimeFormElementConfiguration.Format to set the format. A few helper methods are provided to set the format such as datetime, date and time.

Not set by default

Examples

Simple datepicker

import static com.foreach.across.modules.bootstrapui.ui.factories.BootstrapViewElements.bootstrap;

bootstrap.builders.datetime()
    .value( new Date() )
    .build();

Localized fr_FR Date

import static com.foreach.across.modules.bootstrapui.ui.factories.BootstrapViewElements.bootstrap;

DateTimeFormElementBuilder builder = datetime();
DateTimeFormElementConfiguration config = builder.getConfiguration();
config.setLocale( Locale.forLanguageTag( "fr-FR" ) );
config.setFormat( DateTimeFormElementConfiguration.Format.DATETIME_FULL );
config.setLocalizePatterns( false );

return bootstrap.builders.datetime()
        .configuration( config )
        .value( LocalDateTime.now() )
        .build();