Jifty::Web::Form::Field::DateTime - Add date pickers to your forms


Jifty documentation Contained in the Jifty distribution.

Index


Code Index:

NAME

Top

Jifty::Web::Form::Field::DateTime - Add date pickers to your forms

METHODS

Top

classes

Output date fields with the class 'date'

canonicalize_value

If the value is a DateTime, return nothing if the epoch is 0


Jifty documentation Contained in the Jifty distribution.
use warnings;
use strict;
 
package Jifty::Web::Form::Field::DateTime;

use base qw/Jifty::Web::Form::Field/;

sub classes {
    my $self = shift;
    return join(' ', 'datetime', ($self->SUPER::classes));
}

sub canonicalize_value {
    my $self  = shift;
    my $value = $self->current_value;

    if (UNIVERSAL::isa($value, 'DateTime')) {
        return unless $value->epoch;
    }

    return $value;
}

1;