[freeside-commits] freeside/httemplate/elements
tr-input-date-field.html, 1.2, 1.3
Jeff Finucane,420,,
jeff at wavetail.420.am
Wed Nov 15 22:20:40 PST 2006
Update of /home/cvs/cvsroot/freeside/httemplate/elements
In directory wavetail:/tmp/cvs-serv21828/httemplate/elements
Modified Files:
tr-input-date-field.html
Log Message:
switch birthdate to DateTime
Index: tr-input-date-field.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/tr-input-date-field.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- tr-input-date-field.html 18 Oct 2006 00:05:34 -0000 1.2
+++ tr-input-date-field.html 16 Nov 2006 06:20:37 -0000 1.3
@@ -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>
More information about the freeside-commits
mailing list