2 <LINK REL="stylesheet" TYPE="text/css" HREF="<%$fsurl%>elements/calendar-win2k-2.css" TITLE="win2k-2">
3 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/calendar_stripped.js"></SCRIPT>
4 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/calendar-en.js"></SCRIPT>
5 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/calendar-setup.js"></SCRIPT>
8 <INPUT TYPE="text" NAME="<% $name %>" ID="<% $name %>_text" VALUE="<% $value %>">
9 <IMG SRC="<%$fsurl%>images/calendar.png" ID="<% $name %>_button" STYLE="cursor: pointer" TITLE="<% mt('Select date') |h %>"><IMG SRC="<%$fsurl%>images/calendar-disabled.png" ID="<% $name %>_disabled" STYLE="display:none">
11 <SCRIPT TYPE="text/javascript">
13 inputField: "<% $name %>_text",
14 ifFormat: "<% $format %>",
15 button: "<% $name %>_button",
17 % if ( $format =~ /\%r/ ) {
27 my($name, $value, $format, $usedatetime, $noinit);
30 $name = $opt->{'name'};
31 $value = $opt->{'value'};
32 $format = $opt->{'format'};
33 $usedatetime = $opt->{'usedatetime'};
34 $noinit = $opt->{'noinit'};
36 ($name, $value, $format, $usedatetime) = @_;
39 my $conf = new FS::Conf;
41 $format ||= $conf->config('date_format') || '%m/%d/%Y';
43 if ( $value =~ /\S/ ) {
45 my $dt = DateTime->from_epoch(epoch => $value, time_zone => 'floating');
46 $value = $dt->strftime($format);
47 } elsif ( $value =~ /^\d+$/ ) {
48 $value = time2str($format, $value);