<?php

namespace Engine\RemoteData\InfoBox;

class Field_Date extends FieldAbstract
{

	public function setValue($value)
	{
		if ( !($value instanceof \Engine\DateTime) ) {
			throw new Exception('DateTime field must receive an \Engine\DateTime object for the field `'.$this->label.'`.');
		}

		return parent::setValue($value);
	}

	// Always send false or blank dates as blank to the js interpreter
	protected function exportValue()
	{
		return (String)$this->value->formatDateIso();
	}

}