diff --git a/src/Fields/DateTimeLocalField.php b/src/Fields/DateTimeLocalField.php
new file mode 100644
index 0000000..e09ef5e
--- /dev/null
+++ b/src/Fields/DateTimeLocalField.php
@@ -0,0 +1,29 @@
+`.
+ *
+ * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local
+ */
+class DateTimeLocalField extends DateTimeField
+{
+ const HTML5_FORMAT = "Y-m-d\\TH:i";
+
+ /**
+ * @param string $name field name
+ * @param string $timezone timezone name
+ * @param array $attrs map of HTML attribtues to apply
+ */
+ public function __construct($name, $timezone, $attrs = [])
+ {
+ $attrs += [
+ "type" => "datetime-local",
+ ];
+
+ parent::__construct($name, $timezone, self::HTML5_FORMAT, $attrs);
+ }
+}
diff --git a/tests/unit/FieldRenderCest.php b/tests/unit/FieldRenderCest.php
index b548978..5f028f6 100644
--- a/tests/unit/FieldRenderCest.php
+++ b/tests/unit/FieldRenderCest.php
@@ -5,6 +5,7 @@
use mindplay\kissform\Fields\CheckboxField;
use mindplay\kissform\Fields\DateSelectField;
use mindplay\kissform\Fields\DateTimeField;
+use mindplay\kissform\Fields\DateTimeLocalField;
use mindplay\kissform\Fields\EmailField;
use mindplay\kissform\Fields\FloatField;
use mindplay\kissform\Fields\HiddenField;
@@ -251,8 +252,22 @@ public function renderDateTimeField(UnitTester $I)
$field = new DateTimeField('value', 'Europe/Copenhagen', 'Y-m-d H:i:s', ['readonly' => true]);
$field->setValue($form->model, 173919600);
- $I->assertSame('',
- $form->render($field));
+ $I->assertSame(
+ '',
+ $form->render($field)
+ );
+ }
+
+ public function renderDateTimeLocalField(UnitTester $I)
+ {
+ $form = new InputRenderer();
+ $field = new DateTimeLocalField('value', 'Europe/Copenhagen', ['readonly' => true]);
+ $field->setValue($form->model, 173919600);
+
+ $I->assertSame(
+ '',
+ $form->render($field)
+ );
}
public function renderDateSelector(UnitTester $I)