
###################################################################################
#
#   Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh  www.ecos.de
#   Embperl - Copyright (c) 2008-2015 Gerald Richter
#   Embperl - Copyright (c) 2015-2023 actevy.io
#
#   You may distribute under the terms of either the GNU General Public
#   License or the Artistic License, as specified in the Perl README file.
#
#   THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
#   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
#   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
###################################################################################


package Embperl::Form::Validate::DateTimeEU ;

use base qw(Embperl::Form::Validate::DateTime);
use utf8 ;


# --------------------------------------------------------------

sub validate 
    {
    my ($self, $key, $value, $fdat, $pref) = @_ ;

    if($value =~ /^(\d{1:2})\.(\d{1:2})\.(\d{1:4})\s+(\d{1:2})\.(\d{1:2})\.(\d{1:4})$/)
	{
	if ($1 < 1 || $1 > 31 ||
		$2 < 1 || $2 > 12 ||
		$3 < 1900 || $3 > 2100 ||
	    $4 < 0 || $4 > 23 ||
	    $5 < 0 || $5 > 59 ||
        $6 < 0 || $6 > 59)
	    {
            return ['validate_datetime_eu', $value] ;
	    }
	return undef ;
	}



1;
