File Coverage

blib/lib/Pinwheel/Helpers/DateTime.pm
Criterion Covered Total %
statement 19 19 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 0 3 0.0
total 27 30 90.0


line stmt bran cond sub pod time code
1             package Pinwheel::Helpers::DateTime;
2              
3 5     5   27143 use strict;
  5         8  
  5         170  
4 5     5   24 use warnings;
  5         9  
  5         400  
5              
6 5     5   25 use Exporter;
  5         27  
  5         185  
7              
8 5     5   726 use Pinwheel::Context;
  5         9  
  5         105  
9 5     5   2731 use Pinwheel::Model::Time;
  5         17  
  5         869  
10              
11             our @ISA = qw(Exporter);
12             our @EXPORT_OK = qw(now hh_mm format_time);
13              
14              
15             sub now
16             {
17 1     1 0 17 return Pinwheel::Model::Time::now();
18             }
19              
20             # TOOD: this is available as a method in the Time Model
21             sub hh_mm
22             {
23 1     1 0 5 my ($time) = @_;
24 1         53 return sprintf('%02d:%02d', $time->hour, $time->min);
25             }
26              
27             sub format_time
28             {
29 1     1 0 12 return $_[1]->strftime($_[0]);
30             }
31              
32              
33              
34             1;