summaryrefslogtreecommitdiff
path: root/httemplate/elements/tr-select-from_to.html
blob: c242097379012bb7e84dd56ce1ea35618384ea06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<TR>
  <TD ALIGN="right"><% mt('From: ') |h %></TD>
  <TD>
    <& /elements/select-month_year.html,
                  'prefix'        => 'start',
                  'selected_mon'  => $smonth,
                  'selected_year' => $syear,
                  %hash,
    &>
  </TD>
</TR>

<TR>
  <TD ALIGN="right"><% mt('To: ') |h %></TD>
  <TD>
    <& /elements/select-month_year.html,
                  'prefix'        => 'end',
                  'selected_mon'  => $emonth,
                  'selected_year' => $eyear,
                  %hash,
    &>
  </TD>
</TR>
<%init>
  my ($curmon,$curyear) = (localtime(time))[4,5];
  
  #find first month
  my $syear = 1899+$curyear;
  my $smonth = $curmon+1;
  
  #want 12 month by default, not 13
  $smonth++;
  if ( $smonth > 12 ) { $smonth-=12; $syear++ }
  
  #find last month
  my $eyear = 1900+$curyear;
  my $emonth = $curmon+1;

  my %hash = (
    'show_month_abbr' => 1,
    'start_year'      => '1999',
    'end_year'        => $eyear+3,
     @_,
  );
</%init>