<?php
/**
 * @copyright (c) Kufer Software GmbH, Oderstraße 7, D-84453 Mühldorf
 */

namespace Kufer\Web\KuferTools\Utils\WssField\Allgemein;

class WssFieldAllgemeinDateTime extends \Kufer\Web\KuferTools\Utils\WssField\WssField
{
  protected function getValue($datamodulWert, $isFormular = false)
  {
    $validDateTime = \DateTimeOperations::getValidDateTimeString(parent::getValue($datamodulWert, $isFormular));
    if (\DateTimeOperations::isDateTimeEmptyOrDefault($validDateTime)) {
      return '';
    }

    return $validDateTime;
  }

  protected function isMandatoryValueEmpty($value): bool
  {
    return \DateTimeOperations::isDateTimeEmptyOrDefault($value);
  }
}