diff options
author | jeff <jeff> | 2006-11-16 06:20:38 +0000 |
---|---|---|
committer | jeff <jeff> | 2006-11-16 06:20:38 +0000 |
commit | 7c1d5f4ce778b4ab56301a042076e7c1dce46152 (patch) | |
tree | 5043578159426a7f2b71f4dc08a1ce481efffae7 /httemplate/elements/tr-input-date-field.html | |
parent | 4fc89f725b1ef07a6f1687af0ddeb83988d493c1 (diff) |
switch birthdate to DateTime
Diffstat (limited to 'httemplate/elements/tr-input-date-field.html')
-rw-r--r-- | httemplate/elements/tr-input-date-field.html | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/httemplate/elements/tr-input-date-field.html b/httemplate/elements/tr-input-date-field.html index 0618fc965..1624df05c 100644 --- a/httemplate/elements/tr-input-date-field.html +++ b/httemplate/elements/tr-input-date-field.html @@ -7,7 +7,7 @@ <TR> <TD ALIGN="right"><% $label %></TD> <TD> - <INPUT TYPE="text" NAME="<% $name %>" ID="<% $name %>_text" VALUE="<% ($value eq '') ? '' : time2str($format, $value) %>"> + <INPUT TYPE="text" NAME="<% $name %>" ID="<% $name %>_text" VALUE="<% $value %>"> <IMG SRC="../images/calendar.png" ID="<% $name %>_button" STYLE="cursor: pointer" TITLE="Select date"> </TD> </TR> @@ -23,10 +23,19 @@ <%init> -my($name, $value, $label, $format) = @_; +my($name, $value, $label, $format, $usedatetime) = @_; $format = "%m/%d/%Y" unless $format; $label = $name unless $label; +if ($usedatetime) { + eval "use DateTime;"; + die $@ if $@; + my $dt = DateTime->from_epoch(epoch => $value, time_zone => 'floating'); + $value = $dt->strftime($format); +}else{ + $value = time2str($format, $value); +} + </%init> |