Merge pull request #108 from martinbean/feature/datetime-inputs

Add datetime input types
This commit is contained in:
Adam Engebretson committed 2015-11-06 12:14:38 -06:00
commit 5ad8377968
1 file changed
+36
+36
View File
@@ -359,6 +359,42 @@ class FormBuilder
return $this->input('date', $name, $value, $options); return $this->input('date', $name, $value, $options);
} }
/**
* Create a datetime input field.
*
* @param string $name
* @param string $value
* @param array $options
*
* @return string
*/
public function datetime($name, $value = null, $options = [])
{
if ($value instanceof DateTime) {
$value = $value->format(DateTime::RFC3339);
}
return $this->input('datetime', $name, $value, $options);
}
/**
* Create a datetime-local input field.
*
* @param string $name
* @param string $value
* @param array $options
*
* @return string
*/
public function datetimeLocal($name, $value = null, $options = [])
{
if ($value instanceof DateTime) {
$value = $value->format('Y-m-d\TH:i');
}
return $this->input('datetime-local', $name, $value, $options);
}
/** /**
* Create a time input field. * Create a time input field.
* *