On Mon, Mar 24, 2008 at 10:06 PM, vti <[EMAIL PROTECTED]> wrote:
> Maybe it should be a standart constraint? I think everybody needs it as long
> as
> we have Date element...
>
> sub constrain_value {
> my ( $s, $value ) = @_;
>
> if ( defined $value ) {
> my $builder = DateTime::Format::Builder->new;
> $builder->parser( { strptime => $s->parent->strftime } );
>
> my $dt = $builder->parse_datetime( $value );
>
> return $dt ? 1 : 0;
> }
>
> return 1;
> }
>
If you use deflate then the text is parsed by DateTime anyway - and if
that fails then you get the error - that's probably why no one wrote
it as a constraint.
> --
> vti -- Viacheslav Tikhanovskii
>
> _______________________________________________
> HTML-FormFu mailing list
> [email protected]
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>
--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
_______________________________________________
HTML-FormFu mailing list
[email protected]
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu