Merge pull request #108 from martinbean/feature/datetime-inputs
Add datetime input types
This commit is contained in:
commit
5ad8377968
1 file changed
+36
@@ -359,6 +359,42 @@ class FormBuilder
|
||||
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.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user