Why do you have your validation in your beforeValidation method? All you need is the data transformation on the form item.
public function beforeValidation(array $data)
{
$this->date = sprintf(
'%d-%02d-%02d',
(int) $data['year'],
(int) $data['month'],
(int) $data['day']
);
}
validation on your date field will handle the rest in your initialize.
public function initialize()
{
$date->addValidators(array(
new Date_Validator(array( 'message' => 'The name is required' ))
));
}
you coudl also include your other fields on your form so you can use your form->render() methods in volt if you are using it. then you coudl keep everythign inside the module.
public function initialize()
{
$this->add(new Text('year'));
$this->add(new Text('month'));
$this->add(new Text('day'));
$date = new Date();
$date->addValidators(array(
new Date_Validator(['format' => 'Y-m-d'])
));
$this->add($date);
}
public function beforeValidation()
{
$this->date = sprintf(
'%d-%02d-%02d',
(int) $this->year,
(int) $this->month,
(int) $this->day
);
}