diff --git a/src/fields/Time.php b/src/fields/Time.php new file mode 100644 index 00000000..7bc994f5 --- /dev/null +++ b/src/fields/Time.php @@ -0,0 +1,65 @@ +fetchValue(); + + if ($value === null) { + return null; + } + + $timeValue = DateHelper::parseTimeString($value); + + if ($timeValue) { + return $timeValue; + } + + return $value; + } +} diff --git a/src/services/Fields.php b/src/services/Fields.php index 29421cd0..11ee9643 100644 --- a/src/services/Fields.php +++ b/src/services/Fields.php @@ -38,6 +38,7 @@ use craft\feedme\fields\SuperTable; use craft\feedme\fields\Table; use craft\feedme\fields\Tags; +use craft\feedme\fields\Time; use craft\feedme\fields\TypedLink; use craft\feedme\fields\Users; use craft\helpers\Component as ComponentHelper; @@ -142,6 +143,7 @@ public function getRegisteredFields(): array RadioButtons::class, Table::class, Tags::class, + Time::class, Users::class, // Third-Party diff --git a/src/templates/_includes/fields/time.html b/src/templates/_includes/fields/time.html new file mode 100644 index 00000000..18a35dab --- /dev/null +++ b/src/templates/_includes/fields/time.html @@ -0,0 +1,8 @@ +{% import 'feed-me/_macros' as feedMeMacro %} +{% import '_includes/forms' as forms %} + +{% set default = default ?? { + type: 'time', +} %} + +{% extends 'feed-me/_includes/fields/_base' %} \ No newline at end of file