Usage

HTML (Auto-init)

HTML
<input type="text" class="fw-datetime" id="myDateTime">

<script>
  FormWidgets.autoInit();
</script>

HTML with Data Attributes

HTML
<input type="text" class="fw-datetime"
       data-show-seconds="false"
       data-show-pattern="true">

JavaScript Initialization

JavaScript
FormWidgets.init('#myDateTime', 'DateTimePicker', {
    displayFormat: 'DD/MM/YYYY HH:mm',
    timeFormat: 'HH:mm',
    showSeconds: false,
    showPattern: true
});

Options

OptionTypeDefaultDescription
dateFormatstring'YYYY-MM-DD'Internal date component format.
timeFormatstring'HH:mm:ss'Time component format. Use HH:mm to hide seconds.
displayFormatstring'YYYY-MM-DD HH:mm:ss'Combined display format shown to the user. Should match dateFormat + ' ' + timeFormat.
showSecondsbooleantrueWhen false, hides the seconds selector in the time part of the popup.
showPatternbooleantrueShow the combined format as a placeholder when empty (e.g. YYYY-MM-DD HH:mm:ss).
iconstring'calendarPlus'Name of the SVG icon to use from the internal icon set.
requiredbooleanfalseMarks the field as required with validation.

Data Attributes

Data AttributeEquivalent OptionExample
data-show-secondsshowSecondsdata-show-seconds="false"
data-show-patternshowPatterndata-show-pattern="true"
data-display-formatdisplayFormatdata-display-format="DD/MM/YYYY HH:mm"
data-requiredrequireddata-required="true"

Keyboard Navigation

Enter / Open the date/time picker popup
EscClose the picker
Navigate calendar by day
Navigate calendar by week (in calendar) or change time values (in time selectors)
TabMove through month/year dropdowns, calendar, time selectors, and action buttons
EnterSelect date or apply time and close the popup

Features

Combined Picker

Full calendar + time selectors in one popup — one field, one click.

Manual Input

Type date and time directly in the expected format.

Optional Seconds

Show or hide the seconds selector.

Custom Formats

Any combination of date and time format components.