jonathangeiger / kohana-jelly

See the link below for the most up-to-date code
https://github.com/creatoro/jelly
MIT License
146 stars 34 forks source link

"Null" value in Field_Timestamp #131

Closed gerasim closed 14 years ago

gerasim commented 14 years ago

Hello!

I suggest change the file views/jelly/field/timestamp.php from

echo Form::input($name, date($pretty_format, $value), $attributes + array('id' => 'field-'.$name));

to

echo Form::input($name, (!isset($default) && !isset($value))?'':date($pretty_format, $value), $attributes + array('id' => 'field-'.$name));

elsewise I get a date (1970-01-01) in a form's field even if a default value declared explicitly as null (also parameter 'null'=>true), e.g.

'myField' => new Field_Timestamp(array(
    'format' => 'Y-m-d',
    'pretty_format' => 'Y-m-d',
    'null' => true,
    'default' => null,
)),
jonathangeiger commented 14 years ago

Closed by 4d9fe90334749e536239ab8dd9d3ea3a1193f151. Thanks gerasim!