HTML::FormFu::ExtJS::Element::Date - Date element


HTML-FormFu-ExtJS documentation Contained in the HTML-FormFu-ExtJS distribution.

Index


Code Index:

NAME

Top

HTML::FormFu::ExtJS::Element::Date

VERSION

Top

version 0.090

DESCRIPTION

Top

dateFormat (http://extjs.com/deploy/dev/docs/?class=Ext.form.DateField) is set to Y-m-d. This is the internal representation of a date and this value will be send to the server on submit.

strftime is set to %Y-%m-%d, which is %F the ISO 8601 date format. This is the format for default values.

By default the localozation of ExtJS will do the job and transform this internal value to a more readable version depending on your locale.

column_model

To change the format of the date object specify $element->attrs->{dateFormat}. The date parsing and format syntax is a subset of PHP's date() function. See http://extjs.com/deploy/dev/docs/?class=Date for details. It defaults to Y-m-d (which is the same as Perl's %Y-%m-%d).

NAME

Top

HTML::FormFu::ExtJS::Element::Date - Date element

SEE ALSO

Top

HTML::FormFu::Element::Date

COPYRIGHT & LICENSE

Top

AUTHOR

Top

Moritz Onken <onken@netcubed.de>

COPYRIGHT AND LICENSE

Top


HTML-FormFu-ExtJS documentation Contained in the HTML-FormFu-ExtJS distribution.
#
# This file is part of HTML-FormFu-ExtJS
#
# This software is Copyright (c) 2011 by Moritz Onken.
#
# This is free software, licensed under:
#
#   The (three-clause) BSD License
#
package HTML::FormFu::ExtJS::Element::Date;
BEGIN {
  $HTML::FormFu::ExtJS::Element::Date::VERSION = '0.090';
}

use base "HTML::FormFu::ExtJS::Element::_Field";

use strict;
use warnings;
use utf8;

sub render {
	my $class = shift;
	my $self = shift;
	$self->_date_defaults;
	$self->strftime('%Y-%m-%d');
	$self->default(sprintf("%04s-%02s-%02s", $self->year->{default},$self->month->{default},$self->day->{default}))
	if((defined $self->default || defined $self->default_natural) && $self->year->{default} && $self->month->{default} && $self->day->{default});
	my $super = $class->SUPER::render($self);
	return { %{$super}, xtype => "datefield" };
	
	
}

sub record {
	my $class = shift;
	my $self = shift;
	use Data::Dumper; $Data::Dumper::Indent = 1; warn Dumper $self unless($self->name);
	my $super = $class->SUPER::record($self, @_);
	return {%{$super}, type => "date", dateFormat => 'Y-m-d'}
}

sub column_model {
	my $class = shift;
	my $self = shift;
	my $super = $class->SUPER::column_model($self, @_);
	my $format = $super->{dateFormat} || 'Y-m-d';
	return {%{$super}, renderer => \('Ext.util.Format.dateRenderer("'.$format.'")') }
}


1;


__END__