Completed
Push — master ( c0eb3b...a45428 )
by Rasmus
12:07
created

DateTimeLocalField::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 3
crap 1
1
<?php
2
3
namespace mindplay\kissform\Fields;
4
5
use mindplay\kissform\InputModel;
6
7
/**
8
 * Date/time field-type for string-based input using HTML5 `<input type="datetime-local">`.
9
 *
10
 * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local
11
 */
12
class DateTimeLocalField extends DateTimeField
13
{
14
    const HTML5_FORMAT = "Y-m-d\\TH:i";
15
16
    /**
17
     * @param string $name     field name
18
     * @param string $timezone timezone name
19
     * @param array  $attrs    map of HTML attribtues to apply
20
     */
21 1
    public function __construct($name, $timezone, $attrs = [])
22
    {
23
        $attrs += [
24 1
            "type" => "datetime-local",
25
        ];
26
27 1
        parent::__construct($name, $timezone, self::HTML5_FORMAT, $attrs);
28 1
    }
29
}
30