unimarc bugfix : the encoding is in field 100 in UNIMARC. when TransformHTMLtoXML...
[koha.git] / t / Date.t
1 BEGIN { $| = 1; print "1..4\n"; }
2 END {print "not ok 1\n" unless $loaded;}
3 use C4::Date;
4 $loaded = 1;
5 print "ok 1\n";
6
7 # testing format_date_in_iso
8 my $format= display_date_format ();
9 my $date;
10 if ($format eq 'mm/dd/yyyy'){
11    $date = '05/21/1973';
12 }
13 elsif ($format eq 'dd/mm/yyyy'){   
14    $date = '21/05/1973';
15 }
16 elsif ($format eq 'yyyy-mm-dd'){
17    $date = '1973-05-21';
18 }
19 $date=format_date_in_iso($date);
20 if ($date eq '1973-05-21'){
21   print "ok 2\n";
22 }
23 else {
24   print "not ok 2\n";
25 }
26
27 # test format date
28 $date=format_date($date);
29 if ($format eq 'mm/dd/yyyy'){
30   if ($date eq '05/21/1973'){
31     print "ok 3\n";
32   }
33   else {
34     print "not ok 3\n";
35   }
36 }
37 elsif ($format eq 'dd/mm/yyyy'){
38   if ($date eq '21/05/1973'){
39     print "ok 3\n";
40   }
41   else {
42     print "not ok 3\n";
43   }
44 }
45 elsif ($format eq 'yyyy-mm-dd'){
46   if ($date eq '1973-05-21'){
47     print "ok 3\n";
48   }
49   else {
50     print "not ok 3\n";
51   }
52 }
53 else {
54   print "not ok3\n";
55 }
56
57 # test 4 fixdate
58
59 ($date,$invaliddate) = fixdate('2007','06','31');
60 if ($invaliddate){
61   print "ok 4\n";
62 } else {
63   print "not ok 4\n";
64 }